home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1994-07-24 | 2.8 MB | [ONLN/HLX2] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Mon Jan 24 08:38:02 1994, modified Sun Jul 24 14:36:06 1994, creator 'HLX2', type 'ONLN', 2857580 bytes "develop 4" , at 0x2b9aec 35543 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
100%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [ONLN] |
macFileCreator | [HLX2] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 09 64 65 76 65 6c 6f | 70 20 34 00 00 00 00 00 |..develo|p 4.....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 2b 9a 6c 00 | 00 8a d7 a9 69 7f ba aa |....+.l.|....i...|
|00000060| 58 65 16 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |Xe......|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b3 6d 00 00 |........|.....m..|
|00000080| 64 65 76 65 6c 6f 70 0d | 54 68 65 20 41 70 70 6c |develop.|The Appl|
|00000090| 65 20 54 65 63 68 6e 69 | 63 61 6c 20 4a 6f 75 72 |e Techni|cal Jour|
|000000a0| 6e 61 6c 0d 09 57 52 49 | 54 49 4e 47 20 41 20 0d |nal..WRI|TING A .|
|000000b0| 44 45 56 49 43 45 20 44 | 52 49 56 45 52 0d 49 4e |DEVICE D|RIVER.IN|
|000000c0| 20 43 2b 2b 0d 50 4f 4c | 59 4d 4f 52 50 48 49 43 | C++.POL|YMORPHIC|
|000000d0| 20 43 4f 44 45 20 52 45 | 53 4f 55 52 43 45 53 20 | CODE RE|SOURCES |
|000000e0| 49 4e 20 43 2b 2b 0d 53 | 59 53 54 45 4d 20 37 2e |IN C++.S|YSTEM 7.|
|000000f0| 30 20 53 4e 45 41 4b 53 | 0d 4d 41 43 49 4e 54 4f |0 SNEAKS|.MACINTO|
|00000100| 53 48 20 51 20 26 20 41 | 0d 44 45 56 45 4c 4f 50 |SH Q & A|.DEVELOP|
|00000110| 45 52 20 0d 45 53 53 45 | 4e 54 49 41 4c 53 3a 20 |ER .ESSE|NTIALS: |
|00000120| 49 53 53 55 45 20 34 0d | 41 50 50 4c 45 20 49 49 |ISSUE 4.|APPLE II|
|00000130| 20 51 20 26 20 41 0d 54 | 48 45 20 4d 41 43 49 4e | Q & A.T|HE MACIN|
|00000140| 54 4f 53 48 0d 4e 55 42 | 55 53 20 43 41 52 44 0d |TOSH.NUB|US CARD.|
|00000150| 41 4e 44 20 41 2f 52 4f | 53 45 0d 50 45 52 49 4c |AND A/RO|SE.PERIL|
|00000160| 53 20 4f 46 0d 50 4f 53 | 54 53 43 52 49 50 54 20 |S OF.POS|TSCRIPT |
|00000170| 49 49 0d 41 50 50 4c 45 | 20 49 49 47 53 0d 50 52 |II.APPLE| IIGS.PR|
|00000180| 49 4e 54 45 52 20 44 52 | 49 56 45 52 53 0d f0 0d |INTER DR|IVERS...|
|00000190| 49 73 73 75 65 20 34 20 | 20 20 4f 63 74 6f 62 65 |Issue 4 | Octobe|
|000001a0| 72 20 31 39 39 30 0d 41 | 70 70 6c 65 20 43 6f 6d |r 1990.A|pple Com|
|000001b0| 70 75 74 65 72 2c 20 49 | 6e 63 2e 09 0d 0d 45 20 |puter, I|nc....E |
|000001c0| 44 20 49 20 54 20 4f 20 | 52 20 49 20 41 20 4c 0d |D I T O |R I A L.|
|000001d0| 45 64 69 74 6f 72 20 69 | 6e 20 43 68 69 65 66 d5 |Editor i|n Chief.|
|000001e0| 73 20 43 6c 6f 74 68 69 | 6e 67 20 20 4c 6f 75 65 |s Clothi|ng Loue|
|000001f0| 6c 6c 61 20 50 69 7a 7a | 75 74 69 0d 54 65 63 68 |lla Pizz|uti.Tech|
|00000200| 6e 69 63 61 6c 20 42 75 | 63 6b 73 74 6f 70 70 65 |nical Bu|ckstoppe|
|00000210| 72 20 20 44 61 76 65 20 | 4a 6f 68 6e 73 6f 6e 0d |r Dave |Johnson.|
|00000220| 4d 61 6e 61 67 69 6e 67 | 20 45 64 69 74 6f 72 20 |Managing| Editor |
|00000230| 20 43 61 72 6f 6c 20 57 | 65 73 74 62 65 72 67 0d | Carol W|estberg.|
|00000240| 50 72 6f 64 75 63 74 69 | 6f 6e 20 45 64 69 74 6f |Producti|on Edito|
|00000250| 72 20 20 54 6f 6e 69 20 | 48 61 73 6b 65 6c 6c 0d |r Toni |Haskell.|
|00000260| 44 65 76 65 6c 6f 70 6d | 65 6e 74 61 6c 20 45 64 |Developm|ental Ed|
|00000270| 69 74 6f 72 73 20 20 4c | 6f 72 72 61 69 6e 65 20 |itors L|orraine |
|00000280| 41 6e 64 65 72 73 6f 6e | 2c 0d 09 41 6e 6e 20 43 |Anderson|,..Ann C|
|00000290| 75 6c 6c 65 6e 2c 20 47 | 65 74 61 20 43 61 72 6c |ullen, G|eta Carl|
|000002a0| 73 6f 6e 0d 45 64 69 74 | 6f 72 69 61 6c 20 41 73 |son.Edit|orial As|
|000002b0| 73 69 73 74 61 6e 74 20 | 20 4c 65 6e 6f 72 65 20 |sistant | Lenore |
|000002c0| 5a 65 6c 6f 6e 79 0d 49 | 6e 64 65 78 65 72 20 20 |Zelony.I|ndexer |
|000002d0| 49 72 61 20 4b 6c 65 69 | 6e 62 65 72 67 0d 4d 61 |Ira Klei|nberg.Ma|
|000002e0| 6e 61 67 65 72 2c 20 44 | 65 76 65 6c 6f 70 65 72 |nager, D|eveloper|
|000002f0| 20 50 72 65 73 73 20 20 | 44 61 76 69 64 20 4b 72 | Press |David Kr|
|00000300| 61 74 68 77 6f 68 6c 0d | 41 20 52 20 54 20 20 26 |athwohl.|A R T &|
|00000310| 20 20 50 20 52 20 4f 20 | 44 20 55 20 43 20 54 20 | P R O |D U C T |
|00000320| 49 20 4f 20 4e 0d 44 65 | 73 69 67 6e 2f 41 72 74 |I O N.De|sign/Art|
|00000330| 20 44 69 72 65 63 74 69 | 6f 6e 20 20 4a 6f 73 73 | Directi|on Joss|
|00000340| 20 50 61 72 73 65 79 0d | 54 65 63 68 6e 69 63 61 | Parsey.|Technica|
|00000350| 6c 20 49 6c 6c 75 73 74 | 72 61 74 69 6f 6e 20 20 |l Illust|ration |
|00000360| 4a 2e 20 47 6f 6c 64 73 | 74 65 69 6e 0d 50 72 6f |J. Golds|tein.Pro|
|00000370| 64 75 63 74 69 6f 6e 20 | 20 42 72 75 63 65 20 50 |duction | Bruce P|
|00000380| 6f 74 74 65 72 74 6f 6e | 0d 50 72 69 6e 74 69 6e |otterton|.Printin|
|00000390| 67 20 20 43 72 61 66 74 | 73 6d 61 6e 20 50 72 65 |g Craft|sman Pre|
|000003a0| 73 73 0d 46 69 6c 6d 20 | 50 72 65 70 61 72 61 74 |ss.Film |Preparat|
|000003b0| 69 6f 6e 20 20 46 69 6c | 6d 43 72 61 66 74 0d 50 |ion Fil|mCraft.P|
|000003c0| 68 6f 74 6f 67 72 61 70 | 68 65 72 20 20 52 61 6c |hotograp|her Ral|
|000003d0| 70 68 20 50 6f 72 74 69 | 6c 6c 6f 0d 43 69 72 63 |ph Porti|llo.Circ|
|000003e0| 75 6c 61 74 69 6f 6e 20 | 4d 61 6e 61 67 65 6d 65 |ulation |Manageme|
|000003f0| 6e 74 20 20 44 65 65 20 | 4b 69 61 6d 79 0d 4f 6e |nt Dee |Kiamy.On|
|00000400| 6c 69 6e 65 20 50 72 6f | 64 75 63 74 69 6f 6e 20 |line Pro|duction |
|00000410| 20 43 61 73 73 69 20 43 | 61 72 70 65 6e 74 65 72 | Cassi C|arpenter|
|00000420| 0d 52 20 45 20 56 20 49 | 20 45 20 57 20 20 42 20 |.R E V I| E W B |
|00000430| 4f 20 41 20 52 20 44 0d | 50 65 74 65 20 d2 4c 75 |O A R D.|Pete .Lu|
|00000440| 6b 65 d3 20 41 6c 65 78 | 61 6e 64 65 72 0d 54 69 |ke. Alex|ander.Ti|
|00000450| 6d 20 d2 53 77 65 65 74 | 70 65 61 d3 20 45 6e 77 |m .Sweet|pea. Enw|
|00000460| 61 6c 6c 0d 4c 61 72 72 | 79 20 d2 43 61 74 20 43 |all.Larr|y .Cat C|
|00000470| 6f 75 63 68 d3 20 52 6f | 73 65 6e 73 74 65 69 6e |ouch. Ro|senstein|
|00000480| 0d 41 6e 64 79 20 d2 54 | 68 65 20 53 68 65 62 61 |.Andy .T|he Sheba|
|00000490| 6e 61 74 6f 72 d3 20 53 | 68 65 62 61 6e 6f 77 0d |nator. S|hebanow.|
|000004a0| 53 20 50 20 45 20 43 20 | 49 20 41 20 4c 20 20 54 |S P E C |I A L T|
|000004b0| 20 48 20 41 20 4e 20 4b | 20 53 0d 4d 61 74 74 20 | H A N K| S.Matt |
|000004c0| 44 65 61 74 68 65 72 61 | 67 65 09 0d 43 6c 65 6f |Deathera|ge..Cleo|
|000004d0| 20 48 75 67 67 69 6e 73 | 20 61 6e 64 20 48 61 6c | Huggins| and Hal|
|000004e0| 20 52 75 63 6b 65 72 20 | 63 72 65 61 74 65 64 20 | Rucker |created |
|000004f0| 74 68 65 20 63 6f 76 65 | 72 20 77 69 74 68 20 68 |the cove|r with h|
|00000500| 65 6c 70 20 66 72 6f 6d | 20 74 69 6d 65 6b 65 65 |elp from| timekee|
|00000510| 70 65 72 73 20 70 61 73 | 74 20 61 6e 64 20 70 72 |pers pas|t and pr|
|00000520| 65 73 65 6e 74 2e 20 43 | 6f 76 65 72 20 70 68 6f |esent. C|over pho|
|00000530| 74 6f 67 72 61 70 68 20 | 62 79 20 52 61 6c 70 68 |tograph |by Ralph|
|00000540| 20 50 6f 72 74 69 6c 6c | 6f 2e 0d 64 20 65 20 76 | Portill|o..d e v|
|00000550| 20 65 20 6c 20 6f 20 70 | 2c 20 54 68 65 20 41 70 | e l o p|, The Ap|
|00000560| 70 6c 65 20 54 65 63 68 | 6e 69 63 61 6c 20 4a 6f |ple Tech|nical Jo|
|00000570| 75 72 6e 61 6c 2c 20 69 | 73 20 61 20 71 75 61 72 |urnal, i|s a quar|
|00000580| 74 65 72 6c 79 20 70 75 | 62 6c 69 63 61 74 69 6f |terly pu|blicatio|
|00000590| 6e 20 6f 66 20 44 65 76 | 65 6c 6f 70 65 72 20 50 |n of Dev|eloper P|
|000005a0| 72 65 73 73 2e 0d 09 0d | 0d 09 43 4f 4e 54 45 4e |ress....|..CONTEN|
|000005b0| 54 53 09 57 72 69 74 69 | 6e 67 20 61 20 44 65 76 |TS.Writi|ng a Dev|
|000005c0| 69 63 65 20 44 72 69 76 | 65 72 20 69 6e 20 43 2b |ice Driv|er in C+|
|000005d0| 2b 20 28 57 68 61 74 3f | 20 49 6e 20 43 2b 2b 3f |+ (What?| In C++?|
|000005e0| 29 20 20 62 79 20 54 69 | 6d 20 45 6e 77 61 6c 6c |) by Ti|m Enwall|
|000005f0| 20 20 0d 48 6f 77 20 74 | 6f 20 63 61 70 69 74 61 | .How t|o capita|
|00000600| 6c 69 7a 65 20 6f 6e 20 | 74 68 65 20 61 64 76 61 |lize on |the adva|
|00000610| 6e 74 61 67 65 73 20 6f | 66 20 61 20 68 69 67 68 |ntages o|f a high|
|00000620| 65 72 20 6c 65 76 65 6c | 20 6c 61 6e 67 75 61 67 |er level| languag|
|00000630| 65 20 61 6e 64 20 61 76 | 6f 69 64 20 73 6f 6d 65 |e and av|oid some|
|00000640| 20 6f 66 20 74 68 65 20 | 70 69 74 66 61 6c 6c 73 | of the |pitfalls|
|00000650| 20 79 6f 75 20 6d 61 79 | 20 65 6e 63 6f 75 6e 74 | you may| encount|
|00000660| 65 72 20 69 66 20 79 6f | 75 20 77 72 69 74 65 20 |er if yo|u write |
|00000670| 61 20 64 72 69 76 65 72 | 20 69 6e 20 43 2b 2b 2c |a driver| in C++,|
|00000680| 20 69 6e 63 6c 75 64 69 | 6e 67 20 61 20 63 6f 6d | includi|ng a com|
|00000690| 70 6c 65 74 65 20 65 78 | 61 6d 70 6c 65 20 6f 66 |plete ex|ample of|
|000006a0| 20 61 20 64 65 76 69 63 | 65 20 64 72 69 76 65 72 | a devic|e driver|
|000006b0| 20 69 6e 20 43 2b 2b 2e | 20 20 20 33 37 36 0d 09 | in C++.| 376..|
|000006c0| 09 50 6f 6c 79 6d 6f 72 | 70 68 69 63 20 43 6f 64 |.Polymor|phic Cod|
|000006d0| 65 20 52 65 73 6f 75 72 | 63 65 73 20 69 6e 20 43 |e Resour|ces in C|
|000006e0| 2b 2b 20 20 62 79 20 50 | 61 74 72 69 63 6b 20 43 |++ by P|atrick C|
|000006f0| 2e 20 42 65 61 72 64 20 | 20 20 41 20 6d 65 74 68 |. Beard | A meth|
|00000700| 6f 64 20 6f 66 20 69 6d | 70 6c 65 6d 65 6e 74 69 |od of im|plementi|
|00000710| 6e 67 20 70 6f 6c 79 6d | 6f 72 70 68 69 73 6d 20 |ng polym|orphism |
|00000720| 69 6e 20 73 74 61 6e 64 | 2d 61 6c 6f 6e 65 20 43 |in stand|-alone C|
|00000730| 2b 2b 20 63 6f 64 65 20 | 72 65 73 6f 75 72 63 65 |++ code |resource|
|00000740| 73 2c 20 69 6c 6c 75 73 | 74 72 61 74 65 64 20 62 |s, illus|trated b|
|00000750| 79 20 61 20 77 69 6e 64 | 6f 77 20 64 65 66 69 6e |y a wind|ow defin|
|00000760| 69 74 69 6f 6e 20 66 75 | 6e 63 74 69 6f 6e 20 74 |ition fu|nction t|
|00000770| 68 61 74 20 75 73 65 73 | 20 70 6f 6c 79 6d 6f 72 |hat uses| polymor|
|00000780| 70 68 69 73 6d 2e 20 20 | 20 34 30 30 0d 09 09 53 |phism. | 400...S|
|00000790| 79 73 74 65 6d 20 37 2e | 30 20 53 6e 65 61 6b 73 |ystem 7.|0 Sneaks|
|000007a0| 20 20 20 41 6e 73 77 65 | 72 73 20 66 72 6f 6d 20 | Answe|rs from |
|000007b0| 41 70 70 6c 65 20 43 6f | 6d 70 75 74 65 72 2e 20 |Apple Co|mputer. |
|000007c0| 20 20 34 31 33 0d 09 09 | 4d 61 63 69 6e 74 6f 73 | 413...|Macintos|
|000007d0| 68 20 51 20 26 20 41 20 | 20 20 41 6e 73 77 65 72 |h Q & A | Answer|
|000007e0| 73 20 66 72 6f 6d 20 74 | 68 65 20 4d 61 63 69 6e |s from t|he Macin|
|000007f0| 74 6f 73 68 20 44 54 53 | 20 67 72 6f 75 70 2e 20 |tosh DTS| group. |
|00000800| 20 20 34 31 37 0d 09 09 | 44 65 76 65 6c 6f 70 65 | 417...|Develope|
|00000810| 72 20 45 73 73 65 6e 74 | 69 61 6c 73 3a 20 20 49 |r Essent|ials: I|
|00000820| 73 73 75 65 20 34 20 20 | 20 54 68 65 20 6c 61 74 |ssue 4 | The lat|
|00000830| 65 73 74 20 64 69 73 63 | 20 63 6f 6e 74 61 69 6e |est disc| contain|
|00000840| 69 6e 67 20 65 73 73 65 | 6e 74 69 61 6c 20 74 6f |ing esse|ntial to|
|00000850| 6f 6c 73 0d 66 6f 72 20 | 64 65 76 65 6c 6f 70 65 |ols.for |develope|
|00000860| 72 73 2e 20 20 20 34 32 | 30 0d 09 09 41 70 70 6c |rs. 42|0...Appl|
|00000870| 65 20 49 49 20 51 20 26 | 20 41 20 20 20 41 6e 73 |e II Q &| A Ans|
|00000880| 77 65 72 73 20 66 72 6f | 6d 20 74 68 65 20 41 70 |wers fro|m the Ap|
|00000890| 70 6c 65 20 49 49 20 44 | 54 53 20 67 72 6f 75 70 |ple II D|TS group|
|000008a0| 2e 20 20 20 34 32 32 0d | 09 09 49 6e 73 69 64 65 |. 422.|..Inside|
|000008b0| 20 74 68 65 20 4d 61 63 | 69 6e 74 6f 73 68 20 43 | the Mac|intosh C|
|000008c0| 6f 70 72 6f 63 65 73 73 | 6f 72 20 50 6c 61 74 66 |oprocess|or Platf|
|000008d0| 6f 72 6d 20 61 6e 64 20 | 41 2f 52 4f 53 45 20 20 |orm and |A/ROSE |
|000008e0| 62 79 20 4a 6f 73 65 70 | 68 20 4d 61 75 72 65 72 |by Josep|h Maurer|
|000008f0| 20 20 20 41 6e 20 69 6e | 74 72 6f 64 75 63 74 69 | An in|troducti|
|00000900| 6f 6e 20 74 6f 20 74 68 | 65 20 62 61 73 69 63 73 |on to th|e basics|
|00000910| 20 6f 66 20 74 68 65 20 | 4d 61 63 69 6e 74 6f 73 | of the |Macintos|
|00000920| 68 20 4e 75 42 75 73 20 | 63 61 72 64 20 61 6e 64 |h NuBus |card and|
|00000930| 20 41 2f 52 4f 53 45 20 | 28 74 68 65 20 41 70 70 | A/ROSE |(the App|
|00000940| 6c 65 20 52 65 61 6c 2d | 74 69 6d 65 20 4f 70 65 |le Real-|time Ope|
|00000950| 72 61 74 69 6e 67 20 53 | 79 73 74 65 6d 20 45 6e |rating S|ystem En|
|00000960| 76 69 72 6f 6e 6d 65 6e | 74 29 2e 20 20 49 6e 63 |vironmen|t). Inc|
|00000970| 6c 75 64 65 73 20 61 20 | 63 6c 6f 73 65 20 6c 6f |ludes a |close lo|
|00000980| 6f 6b 20 61 74 20 69 6e | 74 65 72 70 72 6f 63 65 |ok at in|terproce|
|00000990| 73 73 20 63 6f 6d 6d 75 | 6e 69 63 61 74 69 6f 6e |ss commu|nication|
|000009a0| 20 69 6e 20 41 2f 52 4f | 53 45 20 61 6e 64 20 68 | in A/RO|SE and h|
|000009b0| 6f 77 20 74 68 65 20 54 | 6f 6b 65 6e 54 61 6c 6b |ow the T|okenTalk|
|000009c0| 20 63 61 72 64 20 75 73 | 65 73 20 41 2f 52 4f 53 | card us|es A/ROS|
|000009d0| 45 2c 20 70 6c 75 73 20 | 73 6f 6d 65 20 73 61 6d |E, plus |some sam|
|000009e0| 70 6c 65 73 20 6f 66 20 | 41 2f 52 4f 53 45 20 70 |ples of |A/ROSE p|
|000009f0| 72 6f 67 72 61 6d 6d 69 | 6e 67 2e 20 20 20 34 32 |rogrammi|ng. 42|
|00000a00| 34 0d 09 09 54 68 65 20 | 50 65 72 69 6c 73 20 6f |4...The |Perils o|
|00000a10| 66 20 50 6f 73 74 53 63 | 72 69 70 74 d1 54 68 65 |f PostSc|ript.The|
|00000a20| 20 53 65 71 75 65 6c 20 | 20 62 79 20 53 63 6f 74 | Sequel | by Scot|
|00000a30| 74 20 d2 5a 7a d3 20 5a | 69 6d 6d 65 72 6d 61 6e |t .Zz. Z|immerman|
|00000a40| 20 20 20 0d 41 20 64 65 | 73 63 72 69 70 74 69 6f | .A de|scriptio|
|00000a50| 6e 20 6f 66 20 73 6f 6d | 65 20 67 6f 74 63 68 61 |n of som|e gotcha|
|00000a60| 73 20 74 68 61 74 20 63 | 61 6e 20 6f 63 63 75 72 |s that c|an occur|
|00000a70| 20 77 68 65 6e 20 79 6f | 75 20 75 73 65 20 50 6f | when yo|u use Po|
|00000a80| 73 74 53 63 72 69 70 74 | 20 64 69 63 74 69 6f 6e |stScript| diction|
|00000a90| 61 72 69 65 73 20 69 6e | 20 61 70 70 6c 69 63 61 |aries in| applica|
|00000aa0| 74 69 6f 6e 73 2c 20 61 | 6e 64 20 77 61 79 73 20 |tions, a|nd ways |
|00000ab0| 74 6f 20 77 6f 72 6b 20 | 61 72 6f 75 6e 64 20 74 |to work |around t|
|00000ac0| 68 65 6d 2e 20 20 20 34 | 34 36 0d 09 09 44 72 69 |hem. 4|46...Dri|
|00000ad0| 76 69 6e 67 20 74 6f 20 | 50 72 69 6e 74 3a 20 20 |ving to |Print: |
|00000ae0| 41 6e 20 41 70 70 6c 65 | 20 49 49 67 73 20 50 72 |An Apple| IIgs Pr|
|00000af0| 69 6e 74 65 72 20 44 72 | 69 76 65 72 20 20 62 79 |inter Dr|iver by|
|00000b00| 20 4d 61 74 74 20 44 65 | 61 74 68 65 72 61 67 65 | Matt De|atherage|
|00000b10| 20 20 0d 41 6e 20 65 78 | 70 6c 61 6e 61 74 69 6f | .An ex|planatio|
|00000b20| 6e 20 6f 66 20 74 68 65 | 20 6d 79 73 74 65 72 69 |n of the| mysteri|
|00000b30| 65 73 20 6f 66 20 74 68 | 65 20 70 72 69 6e 74 65 |es of th|e printe|
|00000b40| 72 20 64 72 69 76 65 72 | 3a 20 20 77 68 61 74 20 |r driver|: what |
|00000b50| 69 74 20 64 6f 65 73 2c | 20 68 6f 77 20 69 74 20 |it does,| how it |
|00000b60| 64 6f 65 73 20 69 74 2c | 20 61 6e 64 20 68 6f 77 |does it,| and how|
|00000b70| 20 74 6f 20 77 72 69 74 | 65 20 6f 6e 65 2e 20 20 | to writ|e one. |
|00000b80| 41 20 73 61 6d 70 6c 65 | 20 70 72 69 6e 74 65 72 |A sample| printer|
|00000b90| 20 64 72 69 76 65 72 20 | 69 73 20 70 72 6f 76 69 | driver |is provi|
|00000ba0| 64 65 64 2e 20 20 20 34 | 35 34 0d 09 09 49 6e 64 |ded. 4|54...Ind|
|00000bb0| 65 78 20 20 20 34 37 38 | 0d 45 44 49 54 4f 52 49 |ex 478|.EDITORI|
|00000bc0| 41 4c 0d 44 65 61 72 20 | 52 65 61 64 65 72 73 2c |AL.Dear |Readers,|
|00000bd0| 0d 49 20 6a 75 73 74 20 | 67 6f 74 20 62 61 63 6b |.I just |got back|
|00000be0| 20 66 72 6f 6d 20 73 61 | 62 62 61 74 69 63 61 6c | from sa|bbatical|
|00000bf0| 20 61 6e 64 20 69 74 20 | 77 61 73 20 67 72 65 61 | and it |was grea|
|00000c00| 74 3a 20 49 20 6c 65 66 | 74 20 61 6e 64 20 63 6f |t: I lef|t and co|
|00000c10| 75 6c 64 20 68 61 72 64 | 6c 79 20 72 65 6d 65 6d |uld hard|ly remem|
|00000c20| 62 65 72 20 74 68 61 74 | 20 49 20 68 61 64 20 65 |ber that| I had e|
|00000c30| 76 65 72 20 77 6f 72 6b | 65 64 20 66 6f 72 20 41 |ver work|ed for A|
|00000c40| 70 70 6c 65 2c 20 61 6e | 64 20 6e 6f 77 20 74 68 |pple, an|d now th|
|00000c50| 61 74 20 49 d5 6d 20 62 | 61 63 6b 20 49 20 63 61 |at I.m b|ack I ca|
|00000c60| 6e 20 68 61 72 64 6c 79 | 20 72 65 6d 65 6d 62 65 |n hardly| remembe|
|00000c70| 72 20 74 68 61 74 20 49 | 20 65 76 65 72 20 6c 65 |r that I| ever le|
|00000c80| 66 74 2e 20 20 49 74 d5 | 73 20 67 6f 6f 64 2c 20 |ft. It.|s good, |
|00000c90| 49 20 74 68 69 6e 6b 2c | 20 74 6f 20 62 65 20 66 |I think,| to be f|
|00000ca0| 75 6c 6c 79 20 77 68 65 | 72 65 20 79 6f 75 20 61 |ully whe|re you a|
|00000cb0| 72 65 20 61 73 20 79 6f | 75 20 6c 69 6e 67 65 72 |re as yo|u linger|
|00000cc0| 2e 0d 55 70 6f 6e 20 6d | 79 20 72 65 74 75 72 6e |..Upon m|y return|
|00000cd0| 2c 20 49 20 77 61 73 6e | d5 74 20 71 75 69 74 65 |, I wasn|.t quite|
|00000ce0| 20 73 75 72 65 20 68 6f | 77 2c 20 69 6e 20 6d 79 | sure ho|w, in my|
|00000cf0| 20 61 64 76 61 6e 63 65 | 64 20 73 74 61 74 65 20 | advance|d state |
|00000d00| 6f 66 20 65 71 75 69 6c | 69 62 72 69 75 6d 2c 20 |of equil|ibrium, |
|00000d10| 49 20 77 61 73 20 67 6f | 69 6e 67 20 74 6f 20 66 |I was go|ing to f|
|00000d20| 69 6e 64 20 61 20 77 61 | 79 20 66 6f 72 20 64 72 |ind a wa|y for dr|
|00000d30| 69 76 65 72 73 20 61 6e | 64 20 63 6c 6f 63 6b 20 |ivers an|d clock |
|00000d40| 70 61 72 74 73 20 74 6f | 20 6c 69 76 65 20 74 6f |parts to| live to|
|00000d50| 67 65 74 68 65 72 20 69 | 6e 20 61 20 6c 6f 67 69 |gether i|n a logi|
|00000d60| 63 61 6c 20 65 64 69 74 | 6f 72 69 61 6c 2e 20 53 |cal edit|orial. S|
|00000d70| 6f 20 49 20 64 65 63 69 | 64 65 64 20 74 6f 20 74 |o I deci|ded to t|
|00000d80| 68 72 6f 77 20 6c 6f 67 | 69 63 20 6f 75 74 20 74 |hrow log|ic out t|
|00000d90| 68 65 20 77 69 6e 64 6f | 77 20 61 6e 64 20 74 6f |he windo|w and to|
|00000da0| 20 73 74 69 63 6b 20 77 | 69 74 68 20 77 68 61 74 | stick w|ith what|
|00000db0| 20 49 20 6b 6e 6f 77 3a | 20 74 61 6b 69 6e 67 20 | I know:| taking |
|00000dc0| 61 6e 20 61 6e 61 6c 6f | 67 79 20 61 6e 64 20 73 |an analo|gy and s|
|00000dd0| 74 72 65 74 63 68 69 6e | 67 20 69 74 2e 20 20 48 |tretchin|g it. H|
|00000de0| 65 72 65 20 67 6f 65 73 | 2e 0d 43 6c 6f 63 6b 20 |ere goes|..Clock |
|00000df0| 70 61 72 74 73 20 61 72 | 65 20 63 61 72 65 66 75 |parts ar|e carefu|
|00000e00| 6c 6c 79 20 63 72 61 66 | 74 65 64 20 61 63 63 6f |lly craf|ted acco|
|00000e10| 72 64 69 6e 67 20 74 6f | 20 77 65 6c 6c 2d 64 65 |rding to| well-de|
|00000e20| 66 69 6e 65 64 20 72 75 | 6c 65 73 2e 20 20 41 6c |fined ru|les. Al|
|00000e30| 6f 6e 67 20 77 69 74 68 | 20 66 6f 6c 6c 6f 77 69 |ong with| followi|
|00000e40| 6e 67 20 74 68 65 20 72 | 75 6c 65 73 2c 20 63 72 |ng the r|ules, cr|
|00000e50| 65 61 74 69 76 69 74 79 | 20 61 6e 64 20 63 72 61 |eativity| and cra|
|00000e60| 66 74 73 6d 61 6e 73 68 | 69 70 20 61 72 65 20 62 |ftsmansh|ip are b|
|00000e70| 72 6f 75 67 68 74 20 74 | 6f 20 62 65 61 72 2c 20 |rought t|o bear, |
|00000e80| 73 6f 20 73 6f 6d 65 20 | 63 6c 6f 63 6b 73 20 61 |so some |clocks a|
|00000e90| 72 65 20 6d 6f 72 65 20 | 70 6c 65 61 73 69 6e 67 |re more |pleasing|
|00000ea0| 2c 20 62 65 74 74 65 72 | 20 66 75 6e 63 74 69 6f |, better| functio|
|00000eb0| 6e 69 6e 67 2c 20 61 6e | 64 20 6c 6f 6e 67 65 72 |ning, an|d longer|
|00000ec0| 20 6c 61 73 74 69 6e 67 | 20 74 68 61 6e 20 6f 74 | lasting| than ot|
|00000ed0| 68 65 72 73 2e 20 20 54 | 68 69 73 20 69 73 20 68 |hers. T|his is h|
|00000ee0| 6f 77 20 69 74 20 69 73 | 20 77 69 74 68 20 64 72 |ow it is| with dr|
|00000ef0| 69 76 65 72 73 2c 20 74 | 6f 6f 2e 20 20 52 65 73 |ivers, t|oo. Res|
|00000f00| 70 65 63 74 20 66 6f 72 | 20 74 68 65 20 72 75 6c |pect for| the rul|
|00000f10| 65 73 2c 20 63 72 65 61 | 74 69 76 69 74 79 2c 20 |es, crea|tivity, |
|00000f20| 61 6e 64 20 63 72 61 66 | 74 73 6d 61 6e 73 68 69 |and craf|tsmanshi|
|00000f30| 70 20 63 6f 6d 62 69 6e | 65 20 74 6f 20 6d 61 6b |p combin|e to mak|
|00000f40| 65 20 61 20 64 72 69 76 | 65 72 20 74 69 63 6b 2e |e a driv|er tick.|
|00000f50| 0d 43 6c 6f 63 6b 20 70 | 61 72 74 73 20 61 73 20 |.Clock p|arts as |
|00000f60| 61 20 67 72 6f 75 70 20 | 28 6f 72 20 61 20 77 61 |a group |(or a wa|
|00000f70| 74 63 68 29 20 6b 65 65 | 70 20 74 72 61 63 6b 20 |tch) kee|p track |
|00000f80| 6f 66 20 74 68 65 20 6d | 6f 6d 65 6e 74 2d 62 79 |of the m|oment-by|
|00000f90| 2d 6d 6f 6d 65 6e 74 20 | 70 61 73 73 61 67 65 20 |-moment |passage |
|00000fa0| 6f 66 20 74 69 6d 65 2c | 20 66 72 65 65 69 6e 67 |of time,| freeing|
|00000fb0| 20 75 73 20 74 6f 20 66 | 6f 63 75 73 20 6f 75 72 | us to f|ocus our|
|00000fc0| 20 61 74 74 65 6e 74 69 | 6f 6e 20 6f 6e 20 74 68 | attenti|on on th|
|00000fd0| 69 6e 67 73 20 6d 6f 72 | 65 20 72 69 76 65 74 69 |ings mor|e riveti|
|00000fe0| 6e 67 2e 20 20 53 69 6d | 69 6c 61 72 6c 79 2c 20 |ng. Sim|ilarly, |
|00000ff0| 61 20 73 79 73 74 65 6d | 2d 6c 65 76 65 6c 20 64 |a system|-level d|
|00001000| 72 69 76 65 72 20 6c 65 | 74 73 20 79 6f 75 72 20 |river le|ts your |
|00001010| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 66 6f 63 75 |applicat|ion focu|
|00001020| 73 20 6f 6e 20 74 68 69 | 6e 67 73 20 6d 6f 72 65 |s on thi|ngs more|
|00001030| 20 69 6e 74 65 72 65 73 | 74 69 6e 67 20 28 61 6e | interes|ting (an|
|00001040| 64 20 75 73 65 66 75 6c | 29 20 74 68 61 6e 20 68 |d useful|) than h|
|00001050| 61 72 64 77 61 72 65 2d | 73 70 65 63 69 66 69 63 |ardware-|specific|
|00001060| 20 64 65 74 61 69 6c 73 | 2e 20 20 0d 53 6f 20 6d | details|. .So m|
|00001070| 75 63 68 20 66 6f 72 20 | 74 68 65 20 61 6e 61 6c |uch for |the anal|
|00001080| 6f 67 79 2e 20 20 49 6e | 20 74 68 69 73 20 69 73 |ogy. In| this is|
|00001090| 73 75 65 2c 20 4d 61 74 | 74 20 70 72 6f 76 69 64 |sue, Mat|t provid|
|000010a0| 65 73 20 74 68 6f 72 6f | 75 67 68 20 63 6f 76 65 |es thoro|ugh cove|
|000010b0| 72 61 67 65 20 6f 66 20 | 74 68 65 20 70 72 69 6e |rage of |the prin|
|000010c0| 74 65 72 20 64 72 69 76 | 65 72 3a 20 20 77 68 61 |ter driv|er: wha|
|000010d0| 74 20 69 74 20 64 6f 65 | 73 2c 20 68 6f 77 20 69 |t it doe|s, how i|
|000010e0| 74 20 64 6f 65 73 20 69 | 74 2c 20 61 6e 64 20 68 |t does i|t, and h|
|000010f0| 6f 77 20 74 6f 20 77 72 | 69 74 65 20 6f 6e 65 20 |ow to wr|ite one |
|00001100| 66 6f 72 20 74 68 65 20 | 41 70 70 6c 65 20 49 49 |for the |Apple II|
|00001110| 67 73 2e 20 20 5a 7a 20 | 74 65 6c 6c 73 20 65 76 |gs. Zz |tells ev|
|00001120| 65 6e 20 6d 6f 72 65 20 | 61 62 6f 75 74 20 77 68 |en more |about wh|
|00001130| 61 74 20 79 6f 75 72 20 | 61 70 70 6c 69 63 61 74 |at your |applicat|
|00001140| 69 6f 6e 20 63 61 6e 20 | 64 6f 20 77 69 74 68 20 |ion can |do with |
|00001150| 50 6f 73 74 53 63 72 69 | 70 74 20 63 6f 64 65 20 |PostScri|pt code |
|00001160| 74 6f 20 61 76 6f 69 64 | 20 70 65 72 69 6c 73 20 |to avoid| perils |
|00001170| 70 6f 73 65 64 20 62 79 | 20 74 68 65 20 4c 61 73 |posed by| the Las|
|00001180| 65 72 57 72 69 74 65 72 | 20 64 72 69 76 65 72 2e |erWriter| driver.|
|00001190| 20 20 41 6e 64 20 69 66 | 20 79 6f 75 20 64 65 63 | And if| you dec|
|000011a0| 69 64 65 20 74 6f 20 77 | 72 69 74 65 20 79 6f 75 |ide to w|rite you|
|000011b0| 72 20 6f 77 6e 20 64 72 | 69 76 65 72 2c 20 79 6f |r own dr|iver, yo|
|000011c0| 75 20 63 61 6e 20 66 6f | 6c 6c 6f 77 20 74 68 65 |u can fo|llow the|
|000011d0| 20 6c 65 67 69 6f 6e 73 | 20 62 65 66 6f 72 65 20 | legions| before |
|000011e0| 79 6f 75 20 61 6e 64 20 | 6c 61 75 6e 63 68 20 69 |you and |launch i|
|000011f0| 6e 74 6f 20 61 73 73 65 | 6d 62 6c 79 20 6c 61 6e |nto asse|mbly lan|
|00001200| 67 75 61 67 65 2c 20 6f | 72 20 79 6f 75 20 63 61 |guage, o|r you ca|
|00001210| 6e 20 66 6f 6c 6c 6f 77 | 20 54 69 6d d5 73 20 6c |n follow| Tim.s l|
|00001220| 65 61 64 20 61 6e 64 20 | 74 72 79 20 43 2b 2b 2e |ead and |try C++.|
|00001230| 20 0d 4f 6e 20 61 6e 6f | 74 68 65 72 20 74 6f 70 | .On ano|ther top|
|00001240| 69 63 2c 20 53 63 6f 74 | 74 20 41 2e 20 57 69 6c |ic, Scot|t A. Wil|
|00001250| 6c 69 61 6d 73 20 77 72 | 69 74 65 73 3a 0d d2 4f |liams wr|ites:..O|
|00001260| 6e 20 70 61 67 65 20 31 | 32 36 2c 20 49 20 62 65 |n page 1|26, I be|
|00001270| 6c 69 65 76 65 20 74 68 | 61 74 20 74 68 65 20 41 |lieve th|at the A|
|00001280| 6c 6c 6f 63 48 65 61 70 | 20 6d 65 74 68 6f 64 20 |llocHeap| method |
|00001290| 63 61 6c 6c 20 74 6f 20 | 49 6e 69 74 5a 6f 6e 65 |call to |InitZone|
|000012a0| 20 73 68 6f 75 6c 64 20 | 68 61 76 65 20 63 61 6c | should |have cal|
|000012b0| 6c 73 20 74 6f 20 47 65 | 74 5a 6f 6e 65 20 61 6e |ls to Ge|tZone an|
|000012c0| 64 20 53 65 74 5a 6f 6e | 65 20 61 72 6f 75 6e 64 |d SetZon|e around|
|000012d0| 20 69 74 2c 20 6c 69 6b | 65 20 74 68 69 73 3a 0d | it, lik|e this:.|
|000012e0| 54 48 7a 20 20 73 61 76 | 65 64 5a 6f 6e 65 20 3d |THz sav|edZone =|
|000012f0| 20 47 65 74 5a 6f 6e 65 | 20 28 29 3b 0d 49 6e 69 | GetZone| ();.Ini|
|00001300| 74 5a 6f 6e 65 28 6e 69 | 6c 2c 20 6b 4e 75 6d 44 |tZone(ni|l, kNumD|
|00001310| 66 6c 74 4d 61 73 74 65 | 72 73 2c 20 6c 69 6d 69 |fltMaste|rs, limi|
|00001320| 74 50 74 72 2c 20 7a 6f | 6e 65 50 74 72 29 3b 0d |tPtr, zo|nePtr);.|
|00001330| 53 65 74 5a 6f 6e 65 28 | 73 61 76 65 64 5a 6f 6e |SetZone(|savedZon|
|00001340| 65 29 3b 0d 0d 0d d2 49 | 6e 73 69 64 65 20 4d 61 |e);....I|nside Ma|
|00001350| 63 69 6e 74 6f 73 68 2c | 20 76 6f 6c 75 6d 65 20 |cintosh,| volume |
|00001360| 49 49 2c 20 70 61 67 65 | 20 32 39 2c 20 73 61 79 |II, page| 29, say|
|00001370| 73 2c 20 d4 49 6e 69 74 | 5a 6f 6e 65 20 63 72 65 |s, .Init|Zone cre|
|00001380| 61 74 65 73 20 61 20 6e | 65 77 20 68 65 61 70 20 |ates a n|ew heap |
|00001390| 7a 6f 6e 65 2c 20 69 6e | 69 74 69 61 6c 69 7a 65 |zone, in|itialize|
|000013a0| 73 20 69 74 73 20 68 65 | 61 64 65 72 20 61 6e 64 |s its he|ader and|
|000013b0| 20 74 72 61 69 6c 65 72 | 2c 20 61 6e 64 20 6d 61 | trailer|, and ma|
|000013c0| 6b 65 73 20 69 74 20 74 | 68 65 20 63 75 72 72 65 |kes it t|he curre|
|000013d0| 6e 74 20 7a 6f 6e 65 2e | d5 20 20 49 74 d5 73 20 |nt zone.|. It.s |
|000013e0| 74 68 65 20 d4 6d 61 6b | 65 73 20 69 74 20 0d 74 |the .mak|es it .t|
|000013f0| 68 65 20 63 75 72 72 65 | 6e 74 20 7a 6f 6e 65 d5 |he curre|nt zone.|
|00001400| 20 70 61 72 74 20 74 68 | 61 74 d5 73 20 74 68 65 | part th|at.s the|
|00001410| 20 70 72 6f 62 6c 65 6d | 2e 20 20 57 69 74 68 6f | problem|. Witho|
|00001420| 75 74 20 74 68 65 20 63 | 61 6c 6c 73 20 74 6f 20 |ut the c|alls to |
|00001430| 47 65 74 5a 6f 6e 65 20 | 61 6e 64 20 53 65 74 5a |GetZone |and SetZ|
|00001440| 6f 6e 65 2c 20 61 6e 79 | 20 68 61 6e 64 6c 65 73 |one, any| handles|
|00001450| 20 6f 72 20 70 6f 69 6e | 74 65 72 73 20 63 72 65 | or poin|ters cre|
|00001460| 61 74 65 64 20 61 66 74 | 65 72 20 61 20 63 61 6c |ated aft|er a cal|
|00001470| 6c 20 74 6f 20 74 68 65 | 20 41 6c 6c 6f 63 48 65 |l to the| AllocHe|
|00001480| 61 70 20 6d 65 74 68 6f | 64 20 77 6f 75 6c 64 20 |ap metho|d would |
|00001490| 62 65 20 61 6c 6c 6f 63 | 61 74 65 64 20 69 6e 20 |be alloc|ated in |
|000014a0| 74 68 65 20 6e 65 77 20 | 68 65 61 70 20 63 72 65 |the new |heap cre|
|000014b0| 61 74 65 64 20 65 78 70 | 72 65 73 73 6c 79 20 66 |ated exp|ressly f|
|000014c0| 6f 72 20 68 6f 6c 64 69 | 6e 67 20 50 74 72 4f 62 |or holdi|ng PtrOb|
|000014d0| 6a 65 63 74 73 20 61 6e | 64 20 6e 6f 74 20 69 6e |jects an|d not in|
|000014e0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|000014f0| 20 68 65 61 70 20 77 68 | 65 72 65 20 74 68 65 79 | heap wh|ere they|
|00001500| 20 62 65 6c 6f 6e 67 2e | d3 0d 57 65 6c 6c 2c 20 | belong.|..Well, |
|00001510| 77 68 65 6e 20 53 63 6f | 74 74 20 77 72 6f 74 65 |when Sco|tt wrote|
|00001520| 20 68 65 20 77 61 73 20 | 72 69 67 68 74 2c 20 61 | he was |right, a|
|00001530| 6e 64 20 6e 6f 77 20 68 | 65 d5 73 20 73 70 6f 72 |nd now h|e.s spor|
|00001540| 74 69 6e 67 20 61 20 66 | 69 6e 65 20 6e 65 77 20 |ting a f|ine new |
|00001550| 64 65 76 65 6c 6f 70 20 | 73 68 69 72 74 2e 20 20 |develop |shirt. |
|00001560| 57 68 65 6e 20 79 6f 75 | 20 77 72 69 74 65 2c 20 |When you| write, |
|00001570| 79 6f 75 20 77 69 6c 6c | 20 74 6f 6f 2e 0d 4c 6f |you will| too..Lo|
|00001580| 75 65 6c 6c 61 20 50 69 | 7a 7a 75 74 69 0d 45 64 |uella Pi|zzuti.Ed|
|00001590| 69 74 6f 72 0d 57 52 49 | 54 49 4e 47 20 41 20 44 |itor.WRI|TING A D|
|000015a0| 45 56 49 43 45 20 44 52 | 49 56 45 52 20 49 4e 20 |EVICE DR|IVER IN |
|000015b0| 43 2b 2b 20 28 57 48 41 | 54 3f 20 49 4e 20 43 2b |C++ (WHA|T? IN C+|
|000015c0| 2b 3f 29 0d 54 49 4d 20 | 45 4e 57 41 4c 4c 0d 4d |+?).TIM |ENWALL.M|
|000015d0| 6f 73 74 20 64 65 76 65 | 6c 6f 70 65 72 73 20 77 |ost deve|lopers w|
|000015e0| 72 69 74 65 20 64 65 76 | 69 63 65 20 64 72 69 76 |rite dev|ice driv|
|000015f0| 65 72 73 20 69 6e 20 61 | 73 73 65 6d 62 6c 79 20 |ers in a|ssembly |
|00001600| 6c 61 6e 67 75 61 67 65 | 2c 20 72 61 72 65 6c 79 |language|, rarely|
|00001610| 20 63 6f 6e 73 69 64 65 | 72 69 6e 67 20 61 20 68 | conside|ring a h|
|00001620| 69 67 68 65 72 20 6c 65 | 76 65 6c 2c 20 6f 62 6a |igher le|vel, obj|
|00001630| 65 63 74 2d 62 61 73 65 | 64 20 6c 61 6e 67 75 61 |ect-base|d langua|
|00001640| 67 65 20 73 75 63 68 20 | 61 73 20 43 2b 2b 20 66 |ge such |as C++ f|
|00001650| 6f 72 20 73 75 63 68 20 | 61 20 6a 6f 62 2e 20 54 |or such |a job. T|
|00001660| 68 69 73 20 61 72 74 69 | 63 6c 65 20 64 65 73 63 |his arti|cle desc|
|00001670| 72 69 62 65 73 20 73 6f | 6d 65 20 6f 66 20 74 68 |ribes so|me of th|
|00001680| 65 20 61 64 76 61 6e 74 | 61 67 65 73 20 6f 66 20 |e advant|ages of |
|00001690| 68 69 67 68 65 72 20 6c | 65 76 65 6c 20 6c 61 6e |higher l|evel lan|
|000016a0| 67 75 61 67 65 73 20 6f | 76 65 72 20 61 73 73 65 |guages o|ver asse|
|000016b0| 6d 62 6c 79 20 61 6e 64 | 20 77 61 72 6e 73 20 6f |mbly and| warns o|
|000016c0| 66 20 73 6f 6d 65 20 6f | 66 20 74 68 65 20 67 6f |f some o|f the go|
|000016d0| 74 63 68 61 73 20 79 6f | 75 20 6d 61 79 20 65 6e |tchas yo|u may en|
|000016e0| 63 6f 75 6e 74 65 72 20 | 69 66 20 79 6f 75 20 77 |counter |if you w|
|000016f0| 72 69 74 65 20 61 20 64 | 72 69 76 65 72 20 69 6e |rite a d|river in|
|00001700| 20 43 2b 2b 2e 20 41 6e | 20 65 78 61 6d 70 6c 65 | C++. An| example|
|00001710| 20 6f 66 20 61 20 64 65 | 76 69 63 65 20 64 72 69 | of a de|vice dri|
|00001720| 76 65 72 20 77 72 69 74 | 74 65 6e 20 69 6e 20 43 |ver writ|ten in C|
|00001730| 2b 2b 20 66 6f 6c 6c 6f | 77 73 20 61 20 62 72 69 |++ follo|ws a bri|
|00001740| 65 66 20 64 69 73 63 75 | 73 73 69 6f 6e 20 6f 66 |ef discu|ssion of|
|00001750| 20 64 72 69 76 65 72 73 | 20 69 6e 20 67 65 6e 65 | drivers| in gene|
|00001760| 72 61 6c 2e 0d 57 68 65 | 6e 20 79 6f 75 20 74 68 |ral..Whe|n you th|
|00001770| 69 6e 6b 20 6f 66 20 77 | 72 69 74 69 6e 67 20 61 |ink of w|riting a|
|00001780| 20 64 65 76 69 63 65 20 | 64 72 69 76 65 72 2c 20 | device |driver, |
|00001790| 79 6f 75 72 20 66 69 72 | 73 74 20 72 65 61 63 74 |your fir|st react|
|000017a0| 69 6f 6e 20 6d 61 79 20 | 62 65 2c 20 d2 42 75 74 |ion may |be, .But|
|000017b0| 20 49 20 68 61 76 65 6e | d5 74 20 62 72 75 73 68 | I haven|.t brush|
|000017c0| 65 64 20 75 70 20 6f 6e | 20 61 73 73 65 6d 62 6c |ed up on| assembl|
|000017d0| 79 20 6c 61 6e 67 75 61 | 67 65 20 69 6e 20 73 6f |y langua|ge in so|
|000017e0| 6d 65 20 74 69 6d 65 2e | d3 20 41 66 74 65 72 20 |me time.|. After |
|000017f0| 74 61 6b 69 6e 67 20 61 | 20 64 65 65 70 20 62 72 |taking a| deep br|
|00001800| 65 61 74 68 2c 20 79 6f | 75 20 74 68 69 6e 6b 20 |eath, yo|u think |
|00001810| 6f 66 20 61 6e 6f 74 68 | 65 72 20 61 70 70 72 6f |of anoth|er appro|
|00001820| 61 63 68 3a 20 d2 57 68 | 79 20 63 61 6e d5 74 20 |ach: .Wh|y can.t |
|00001830| 49 20 75 73 65 20 61 20 | 68 69 67 68 2d 6c 65 76 |I use a |high-lev|
|00001840| 65 6c 20 6c 61 6e 67 75 | 61 67 65 3f d3 20 59 6f |el langu|age?. Yo|
|00001850| 75 20 63 61 6e 2e 20 4f | 6e 65 20 73 75 63 68 20 |u can. O|ne such |
|00001860| 6c 61 6e 67 75 61 67 65 | 20 69 73 20 43 2b 2b 2e |language| is C++.|
|00001870| 20 0d 49 6e 20 63 6f 6d | 70 61 72 69 73 6f 6e 20 | .In com|parison |
|00001880| 77 69 74 68 20 73 74 61 | 6e 64 61 72 64 20 43 2c |with sta|ndard C,|
|00001890| 20 43 2b 2b 20 6f 66 66 | 65 72 73 20 73 6f 6d 65 | C++ off|ers some|
|000018a0| 20 64 65 66 69 6e 69 74 | 65 20 61 64 76 61 6e 74 | definit|e advant|
|000018b0| 61 67 65 73 2c 20 69 6e | 63 6c 75 64 69 6e 67 20 |ages, in|cluding |
|000018c0| 65 61 73 65 20 6f 66 20 | 6d 61 69 6e 74 65 6e 61 |ease of |maintena|
|000018d0| 6e 63 65 2c 20 70 6f 72 | 74 61 62 69 6c 69 74 79 |nce, por|tability|
|000018e0| 2c 20 61 6e 64 20 72 65 | 75 73 61 62 69 6c 69 74 |, and re|usabilit|
|000018f0| 79 2e 20 59 6f 75 20 63 | 61 6e 20 65 6e 63 61 70 |y. You c|an encap|
|00001900| 73 75 6c 61 74 65 20 64 | 61 74 61 20 61 6e 64 20 |sulate d|ata and |
|00001910| 66 75 6e 63 74 69 6f 6e | 73 20 69 6e 74 6f 20 63 |function|s into c|
|00001920| 6c 61 73 73 65 73 2c 20 | 67 69 76 69 6e 67 20 66 |lasses, |giving f|
|00001930| 75 74 75 72 65 20 63 6f | 64 65 72 73 20 61 6e 20 |uture co|ders an |
|00001940| 65 61 73 69 65 72 20 6a | 6f 62 20 6f 66 20 6d 61 |easier j|ob of ma|
|00001950| 69 6e 74 61 69 6e 69 6e | 67 20 61 6e 64 20 65 6e |intainin|g and en|
|00001960| 68 61 6e 63 69 6e 67 20 | 77 68 61 74 20 79 6f 75 |hancing |what you|
|00001970| d5 76 65 20 64 6f 6e 65 | 2e 20 41 6e 64 20 79 6f |.ve done|. And yo|
|00001980| 75 20 63 61 6e 20 74 61 | 6b 65 20 61 64 76 61 6e |u can ta|ke advan|
|00001990| 74 61 67 65 20 6f 66 20 | 6d 6f 73 74 20 28 62 75 |tage of |most (bu|
|000019a0| 74 20 6e 6f 74 20 61 6c | 6c 29 20 6f 66 20 74 68 |t not al|l) of th|
|000019b0| 65 20 70 6f 77 65 72 66 | 75 6c 20 66 65 61 74 75 |e powerf|ul featu|
|000019c0| 72 65 73 20 6f 66 20 43 | 2b 2b 20 77 68 65 6e 20 |res of C|++ when |
|000019d0| 79 6f 75 20 77 72 69 74 | 65 20 73 74 61 6e 64 2d |you writ|e stand-|
|000019e0| 61 6c 6f 6e 65 20 63 6f | 64 65 2e 0d 59 6f 75 20 |alone co|de..You |
|000019f0| 77 69 6c 6c 20 72 75 6e | 20 69 6e 74 6f 20 61 20 |will run| into a |
|00001a00| 66 65 77 20 67 6f 74 63 | 68 61 73 2c 20 69 6e 63 |few gotc|has, inc|
|00001a10| 6c 75 64 69 6e 67 20 74 | 68 65 20 66 61 63 74 20 |luding t|he fact |
|00001a20| 74 68 61 74 20 70 6f 6c | 79 6d 6f 72 70 68 69 73 |that pol|ymorphis|
|00001a30| 6d 20 69 73 20 61 76 61 | 69 6c 61 62 6c 65 20 0d |m is ava|ilable .|
|00001a40| 6f 6e 6c 79 20 69 66 20 | 79 6f 75 20 64 6f 20 73 |only if |you do s|
|00001a50| 6f 6d 65 20 65 78 74 72 | 61 20 77 6f 72 6b 20 28 |ome extr|a work (|
|00001a60| 66 6f 72 20 61 20 64 65 | 66 69 6e 69 74 69 6f 6e |for a de|finition|
|00001a70| 20 6f 66 20 70 6f 6c 79 | 6d 6f 72 70 68 69 73 6d | of poly|morphism|
|00001a80| 2c 20 73 65 65 20 64 65 | 76 65 6c 6f 70 2c 0d 49 |, see de|velop,.I|
|00001a90| 73 73 75 65 20 32 2c 20 | 70 61 67 65 20 31 38 30 |ssue 2, |page 180|
|00001aa0| 29 2e 20 42 65 63 61 75 | 73 65 20 74 68 65 20 76 |). Becau|se the v|
|00001ab0| 69 72 74 75 61 6c 20 74 | 61 62 6c 65 73 20 28 76 |irtual t|ables (v|
|00001ac0| 54 61 62 6c 65 73 29 20 | 72 65 73 69 64 65 20 69 |Tables) |reside i|
|00001ad0| 6e 20 74 68 65 20 6a 75 | 6d 70 2d 74 61 62 6c 65 |n the ju|mp-table|
|00001ae0| 20 73 65 67 6d 65 6e 74 | 2c 20 61 20 73 74 61 6e | segment|, a stan|
|00001af0| 64 2d 61 6c 6f 6e 65 20 | 63 6f 64 65 20 72 65 73 |d-alone |code res|
|00001b00| 6f 75 72 63 65 20 63 61 | 6e d5 74 20 67 65 74 20 |ource ca|n.t get |
|00001b10| 61 74 20 74 68 65 20 76 | 54 61 62 6c 65 73 20 64 |at the v|Tables d|
|00001b20| 69 72 65 63 74 6c 79 20 | 28 6d 6f 72 65 20 6f 6e |irectly |(more on|
|00001b30| 20 74 68 69 73 20 74 6f | 70 69 63 20 6c 61 74 65 | this to|pic late|
|00001b40| 72 29 2e 20 59 6f 75 20 | 61 6c 73 6f 20 68 61 76 |r). You |also hav|
|00001b50| 65 20 74 6f 20 64 65 61 | 6c 20 77 69 74 68 20 66 |e to dea|l with f|
|00001b60| 61 63 74 6f 72 73 20 73 | 75 63 68 20 61 73 20 68 |actors s|uch as h|
|00001b70| 6f 77 20 70 61 72 61 6d | 65 74 65 72 73 20 61 72 |ow param|eters ar|
|00001b80| 65 20 70 61 73 73 65 64 | 20 74 6f 20 6d 65 74 68 |e passed| to meth|
|00001b90| 6f 64 73 2c 20 68 6f 77 | 20 6d 65 74 68 6f 64 73 |ods, how| methods|
|00001ba0| 20 61 72 65 20 63 61 6c | 6c 65 64 2c 20 68 6f 77 | are cal|led, how|
|00001bb0| 20 79 6f 75 20 72 65 74 | 75 72 6e 20 74 6f 20 74 | you ret|urn to t|
|00001bc0| 68 65 20 44 65 76 69 63 | 65 20 4d 61 6e 61 67 65 |he Devic|e Manage|
|00001bd0| 72 2c 20 68 6f 77 20 79 | 6f 75 20 63 6f 6d 70 69 |r, how y|ou compi|
|00001be0| 6c 65 20 61 6e 64 20 6c | 69 6e 6b 20 74 68 65 20 |le and l|ink the |
|00001bf0| 44 52 56 52 20 72 65 73 | 6f 75 72 63 65 2c 20 61 |DRVR res|ource, a|
|00001c00| 6e 64 20 68 6f 77 20 74 | 68 65 20 44 52 56 52 20 |nd how t|he DRVR |
|00001c10| 72 65 73 6f 75 72 63 65 | 20 69 73 20 69 6e 73 74 |resource| is inst|
|00001c20| 61 6c 6c 65 64 20 77 68 | 65 6e 20 74 68 65 20 6d |alled wh|en the m|
|00001c30| 61 63 68 69 6e 65 20 73 | 74 61 72 74 73 20 75 70 |achine s|tarts up|
|00001c40| 2e 20 57 65 d5 6c 6c 20 | 74 61 63 6b 6c 65 20 73 |. We.ll |tackle s|
|00001c50| 6f 6d 65 20 6f 66 20 74 | 68 65 73 65 20 6f 62 73 |ome of t|hese obs|
|00001c60| 74 61 63 6c 65 73 20 61 | 73 20 77 65 20 77 6f 72 |tacles a|s we wor|
|00001c70| 6b 20 74 68 72 6f 75 67 | 68 20 74 68 65 20 73 61 |k throug|h the sa|
|00001c80| 6d 70 6c 65 20 64 65 76 | 69 63 65 20 64 72 69 76 |mple dev|ice driv|
|00001c90| 65 72 20 70 72 65 73 65 | 6e 74 65 64 20 6c 61 74 |er prese|nted lat|
|00001ca0| 65 72 20 69 6e 20 74 68 | 69 73 20 61 72 74 69 63 |er in th|is artic|
|00001cb0| 6c 65 2e 0d 57 48 59 20 | 43 2b 2b 3f 0d 57 68 65 |le..WHY |C++?.Whe|
|00001cc0| 6e 20 73 6f 6d 65 6f 6e | 65 20 73 75 67 67 65 73 |n someon|e sugges|
|00001cd0| 74 73 20 77 72 69 74 69 | 6e 67 20 61 20 64 65 76 |ts writi|ng a dev|
|00001ce0| 69 63 65 20 64 72 69 76 | 65 72 20 69 6e 20 61 6e |ice driv|er in an|
|00001cf0| 79 74 68 69 6e 67 20 6f | 74 68 65 72 20 74 68 61 |ything o|ther tha|
|00001d00| 6e 20 61 73 73 65 6d 62 | 6c 79 20 6c 61 6e 67 75 |n assemb|ly langu|
|00001d10| 61 67 65 2c 20 74 68 65 | 20 63 6f 6d 6d 6f 6e 20 |age, the| common |
|00001d20| 72 65 61 63 74 69 6f 6e | 20 69 73 2c 20 d2 42 75 |reaction| is, .Bu|
|00001d30| 74 20 79 6f 75 d5 72 65 | 20 74 61 6c 6b 69 6e 67 |t you.re| talking|
|00001d40| 20 74 6f 20 61 20 64 65 | 76 69 63 65 21 20 57 68 | to a de|vice! Wh|
|00001d50| 79 20 77 6f 75 6c 64 20 | 79 6f 75 20 77 61 6e 74 |y would |you want|
|00001d60| 20 74 6f 20 75 73 65 20 | 43 2b 2b 3f d3 20 0d 46 | to use |C++?. .F|
|00001d70| 6f 72 20 63 6f 6d 6d 75 | 6e 69 63 61 74 69 6f 6e |or commu|nication|
|00001d80| 20 77 69 74 68 20 64 65 | 76 69 63 65 73 2c 20 61 | with de|vices, a|
|00001d90| 73 73 65 6d 62 6c 79 20 | 6c 61 6e 67 75 61 67 65 |ssembly |language|
|00001da0| 20 61 64 6d 69 74 74 65 | 64 6c 79 20 67 65 74 73 | admitte|dly gets|
|00001db0| 20 74 68 65 20 6a 6f 62 | 20 64 6f 6e 65 20 69 6e | the job| done in|
|00001dc0| 20 6d 69 6e 69 6d 61 6c | 20 74 69 6d 65 2c 20 77 | minimal| time, w|
|00001dd0| 69 74 68 20 6d 61 78 69 | 6d 75 6d 20 65 66 66 69 |ith maxi|mum effi|
|00001de0| 63 69 65 6e 63 79 2e 20 | 42 75 74 20 69 66 20 79 |ciency. |But if y|
|00001df0| 6f 75 d5 72 65 20 77 72 | 69 74 69 6e 67 20 73 6f |ou.re wr|iting so|
|00001e00| 6d 65 74 68 69 6e 67 20 | 77 68 65 72 65 20 63 6f |mething |where co|
|00001e10| 64 65 20 6d 61 69 6e 74 | 65 6e 61 6e 63 65 2c 20 |de maint|enance, |
|00001e20| 70 6f 72 74 61 62 69 6c | 69 74 79 2c 20 61 6e 64 |portabil|ity, and|
|00001e30| 20 68 69 67 68 2d 6c 65 | 76 65 6c 20 6c 61 6e 67 | high-le|vel lang|
|00001e40| 75 61 67 65 20 66 75 6e | 63 74 69 6f 6e 61 6c 69 |uage fun|ctionali|
|00001e50| 74 79 20 61 72 65 20 6a | 75 73 74 20 61 73 20 69 |ty are j|ust as i|
|00001e60| 6d 70 6f 72 74 61 6e 74 | 20 61 73 20 73 70 65 65 |mportant| as spee|
|00001e70| 64 20 61 6e 64 20 65 66 | 66 69 63 69 65 6e 63 79 |d and ef|ficiency|
|00001e80| 2c 20 61 20 68 69 67 68 | 65 72 20 6c 65 76 65 6c |, a high|er level|
|00001e90| 20 6c 61 6e 67 75 61 67 | 65 20 69 73 20 70 72 65 | languag|e is pre|
|00001ea0| 66 65 72 61 62 6c 65 2e | 20 0d 4e 6f 74 20 61 6c |ferable.| .Not al|
|00001eb0| 6c 20 64 65 76 69 63 65 | 20 64 72 69 76 65 72 73 |l device| drivers|
|00001ec0| 20 61 63 74 75 61 6c 6c | 79 20 63 6f 6d 6d 75 6e | actuall|y commun|
|00001ed0| 69 63 61 74 65 20 77 69 | 74 68 20 70 68 79 73 69 |icate wi|th physi|
|00001ee0| 63 61 6c 20 64 65 76 69 | 63 65 73 2e 20 4d 61 6e |cal devi|ces. Man|
|00001ef0| 79 20 64 65 76 69 63 65 | 20 64 72 69 76 65 72 73 |y device| drivers|
|00001f00| 20 68 61 76 65 20 6d 6f | 72 65 20 65 73 6f 74 65 | have mo|re esote|
|00001f10| 72 69 63 20 66 75 6e 63 | 74 69 6f 6e 73 2c 20 73 |ric func|tions, s|
|00001f20| 75 63 68 20 61 73 20 69 | 6e 74 65 72 61 70 70 6c |uch as i|nterappl|
|00001f30| 69 63 61 74 69 6f 6e 20 | 63 6f 6d 6d 75 6e 69 63 |ication |communic|
|00001f40| 61 74 69 6f 6e 2c 20 61 | 73 20 0d 69 6e 20 74 68 |ation, a|s .in th|
|00001f50| 65 20 73 61 6d 70 6c 65 | 20 64 72 69 76 65 72 20 |e sample| driver |
|00001f60| 69 6e 20 74 68 69 73 20 | 61 72 74 69 63 6c 65 2e |in this |article.|
|00001f70| 20 28 49 6e 20 66 61 63 | 74 2c 20 44 41 73 20 61 | (In fac|t, DAs a|
|00001f80| 72 65 20 6f 66 20 72 65 | 73 6f 75 72 63 65 20 74 |re of re|source t|
|00001f90| 79 70 65 20 44 52 56 52 | 20 61 6e 64 20 62 65 68 |ype DRVR| and beh|
|00001fa0| 61 76 65 20 65 78 61 63 | 74 6c 79 20 74 68 65 20 |ave exac|tly the |
|00001fb0| 73 61 6d 65 20 77 61 79 | 20 64 65 76 69 63 65 20 |same way| device |
|00001fc0| 64 72 69 76 65 72 73 20 | 62 65 68 61 76 65 2e 20 |drivers |behave. |
|00001fd0| 44 41 73 20 61 72 65 20 | 65 76 65 6e 20 63 72 65 |DAs are |even cre|
|00001fe0| 61 74 65 64 20 74 68 65 | 20 73 61 6d 65 20 77 61 |ated the| same wa|
|00001ff0| 79 2e 29 20 46 6f 72 20 | 74 68 65 73 65 20 6b 69 |y.) For |these ki|
|00002000| 6e 64 73 20 6f 66 20 64 | 65 76 69 63 65 20 64 72 |nds of d|evice dr|
|00002010| 69 76 65 72 73 2c 20 43 | 2b 2b 20 69 73 20 61 20 |ivers, C|++ is a |
|00002020| 67 72 65 61 74 20 6c 61 | 6e 67 75 61 67 65 20 74 |great la|nguage t|
|00002030| 6f 20 75 73 65 20 62 65 | 63 61 75 73 65 20 79 6f |o use be|cause yo|
|00002040| 75 20 63 61 6e 20 74 61 | 6b 65 20 61 64 76 61 6e |u can ta|ke advan|
|00002050| 74 61 67 65 20 6f 66 20 | 61 6c 6c 20 74 68 65 20 |tage of |all the |
|00002060| 66 65 61 74 75 72 65 73 | 20 6f 66 20 61 20 68 69 |features| of a hi|
|00002070| 67 68 2d 6c 65 76 65 6c | 20 6c 61 6e 67 75 61 67 |gh-level| languag|
|00002080| 65 2c 20 70 6c 75 73 20 | 6d 6f 73 74 20 6f 66 20 |e, plus |most of |
|00002090| 74 68 65 20 6f 62 6a 65 | 63 74 2d 62 61 73 65 64 |the obje|ct-based|
|000020a0| 20 66 65 61 74 75 72 65 | 73 20 6f 66 20 43 2b 2b | feature|s of C++|
|000020b0| 2e 20 46 69 6e 61 6c 6c | 79 2c 20 64 65 76 69 63 |. Finall|y, devic|
|000020c0| 65 20 64 72 69 76 65 72 | 73 20 68 61 76 65 20 73 |e driver|s have s|
|000020d0| 6f 6d 65 20 6e 69 63 65 | 20 66 65 61 74 75 72 65 |ome nice| feature|
|000020e0| 73 20 74 68 61 74 20 6d | 61 6b 65 20 74 68 65 6d |s that m|ake them|
|000020f0| 20 61 70 70 65 61 6c 69 | 6e 67 20 66 6f 72 20 67 | appeali|ng for g|
|00002100| 65 6e 65 72 61 6c 20 75 | 73 61 67 65 3a 20 0d a5 |eneral u|sage: ..|
|00002110| 20 54 68 65 79 20 63 61 | 6e 20 72 65 6d 61 69 6e | They ca|n remain|
|00002120| 20 69 6e 20 74 68 65 20 | 73 79 73 74 65 6d 20 68 | in the |system h|
|00002130| 65 61 70 2c 20 70 72 6f | 76 69 64 69 6e 67 20 61 |eap, pro|viding a|
|00002140| 20 63 6f 6d 6d 6f 6e 20 | 0d 69 6e 74 65 72 66 61 | common |.interfa|
|00002150| 63 65 20 66 6f 72 20 61 | 6e 79 20 61 70 70 6c 69 |ce for a|ny appli|
|00002160| 63 61 74 69 6f 6e 20 74 | 6f 20 65 61 73 69 6c 79 |cation t|o easily|
|00002170| 20 63 61 6c 6c 20 61 6e | 64 20 75 73 65 2e 0d a5 | call an|d use...|
|00002180| 20 54 68 65 79 20 67 65 | 74 20 70 65 72 69 6f 64 | They ge|t period|
|00002190| 69 63 20 74 69 6d 65 20 | 28 69 66 20 6f 74 68 65 |ic time |(if othe|
|000021a0| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 73 20 61 |r applic|ations a|
|000021b0| 72 65 20 6e 6f 74 20 68 | 6f 67 67 69 6e 67 20 74 |re not h|ogging t|
|000021c0| 68 65 20 43 50 55 29 2e | 0d 47 6f 6f 64 20 65 78 |he CPU).|.Good ex|
|000021d0| 61 6d 70 6c 65 73 20 6f | 66 20 6e 6f 6e 64 65 76 |amples o|f nondev|
|000021e0| 69 63 65 20 64 72 69 76 | 65 72 73 20 61 72 65 20 |ice driv|ers are |
|000021f0| 74 68 65 20 2e 4d 50 50 | 20 28 41 70 70 6c 65 54 |the .MPP| (AppleT|
|00002200| 61 6c 6b a8 29 20 64 72 | 69 76 65 72 20 61 6e 64 |alk.) dr|iver and|
|00002210| 20 74 68 65 20 2e 49 50 | 43 20 28 41 2f 52 4f 53 | the .IP|C (A/ROS|
|00002220| 45 aa 20 69 6e 74 65 72 | 70 72 6f 63 65 73 73 20 |E. inter|process |
|00002230| 63 6f 6d 6d 75 6e 69 63 | 61 74 69 6f 6e 29 20 64 |communic|ation) d|
|00002240| 72 69 76 65 72 2e 20 42 | 6f 74 68 20 74 68 65 73 |river. B|oth thes|
|00002250| 65 20 64 72 69 76 65 72 | 73 20 70 72 6f 76 69 64 |e driver|s provid|
|00002260| 65 20 70 72 65 74 74 79 | 20 68 69 67 68 2d 6c 65 |e pretty| high-le|
|00002270| 76 65 6c 20 66 75 6e 63 | 74 69 6f 6e 61 6c 69 74 |vel func|tionalit|
|00002280| 79 2c 20 62 75 74 20 6e | 65 69 74 68 65 72 20 64 |y, but n|either d|
|00002290| 69 72 65 63 74 6c 79 20 | 6d 61 6e 69 70 75 6c 61 |irectly |manipula|
|000022a0| 74 65 73 20 61 20 64 65 | 76 69 63 65 20 61 73 20 |tes a de|vice as |
|000022b0| 73 75 63 68 20 28 65 78 | 63 65 70 74 20 66 6f 72 |such (ex|cept for|
|000022c0| 20 74 68 65 20 76 65 72 | 79 20 6c 6f 77 2d 6c 65 | the ver|y low-le|
|000022d0| 76 65 6c 20 41 70 70 6c | 65 54 61 6c 6b 20 6d 61 |vel Appl|eTalk ma|
|000022e0| 6e 69 70 75 6c 61 74 69 | 6f 6e 73 20 6f 66 20 63 |nipulati|ons of c|
|000022f0| 6f 6d 6d 75 6e 69 63 61 | 74 69 6f 6e 20 70 6f 72 |ommunica|tion por|
|00002300| 74 73 29 2e 20 4f 66 20 | 63 6f 75 72 73 65 2c 20 |ts). Of |course, |
|00002310| 69 66 20 79 6f 75 20 77 | 65 72 65 20 77 72 69 74 |if you w|ere writ|
|00002320| 69 6e 67 20 63 6f 64 65 | 20 74 6f 20 63 6f 6d 6d |ing code| to comm|
|00002330| 75 6e 69 63 61 74 65 20 | 71 75 69 63 6b 6c 79 20 |unicate |quickly |
|00002340| 61 6e 64 20 65 66 66 69 | 63 69 65 6e 74 6c 79 20 |and effi|ciently |
|00002350| 74 6f 20 61 20 6d 6f 64 | 65 6d 2c 20 66 6f 72 20 |to a mod|em, for |
|00002360| 65 78 61 6d 70 6c 65 2c | 20 61 73 73 65 6d 62 6c |example,| assembl|
|00002370| 79 20 6c 61 6e 67 75 61 | 67 65 20 6d 69 67 68 74 |y langua|ge might|
|00002380| 20 62 65 20 74 68 65 20 | 62 65 74 74 65 72 20 63 | be the |better c|
|00002390| 68 6f 69 63 65 2c 20 64 | 65 70 65 6e 64 69 6e 67 |hoice, d|epending|
|000023a0| 20 6f 6e 20 79 6f 75 72 | 20 6e 65 65 64 20 66 6f | on your| need fo|
|000023b0| 72 20 65 66 66 69 63 69 | 65 6e 63 79 20 61 6e 64 |r effici|ency and|
|000023c0| 20 74 69 6d 69 6e 67 2e | 20 46 6f 72 20 74 68 65 | timing.| For the|
|000023d0| 20 70 75 72 70 6f 73 65 | 73 20 6f 66 20 74 68 69 | purpose|s of thi|
|000023e0| 73 20 61 72 74 69 63 6c | 65 2c 20 61 6e 79 20 72 |s articl|e, any r|
|000023f0| 65 66 65 72 65 6e 63 65 | 20 74 6f 20 61 20 64 65 |eference| to a de|
|00002400| 76 69 63 65 20 64 72 69 | 76 65 72 20 69 6e 63 6c |vice dri|ver incl|
|00002410| 75 64 65 73 20 62 6f 74 | 68 20 74 79 70 65 73 20 |udes bot|h types |
|00002420| 6f 66 20 64 72 69 76 65 | 72 73 2e 0d 43 6c 65 61 |of drive|rs..Clea|
|00002430| 72 6c 79 2c 20 68 69 67 | 68 65 72 20 6c 65 76 65 |rly, hig|her leve|
|00002440| 6c 20 6c 61 6e 67 75 61 | 67 65 73 20 68 61 76 65 |l langua|ges have|
|00002450| 20 61 20 70 6c 61 63 65 | 2c 20 62 75 74 20 77 68 | a place|, but wh|
|00002460| 61 74 20 61 62 6f 75 74 | 20 6f 62 6a 65 63 74 2d |at about| object-|
|00002470| 62 61 73 65 64 20 6c 61 | 6e 67 75 61 67 65 73 3f |based la|nguages?|
|00002480| 20 4f 62 6a 65 63 74 2d | 62 61 73 65 64 20 6c 61 | Object-|based la|
|00002490| 6e 67 75 61 67 65 73 20 | 70 72 6f 76 69 64 65 20 |nguages |provide |
|000024a0| 61 20 67 72 65 61 74 20 | 66 72 61 6d 65 77 6f 72 |a great |framewor|
|000024b0| 6b 20 66 6f 72 20 65 6e | 63 61 70 73 75 6c 61 74 |k for en|capsulat|
|000024c0| 69 6f 6e 20 6f 66 20 64 | 61 74 61 20 61 6e 64 20 |ion of d|ata and |
|000024d0| 66 75 6e 63 74 69 6f 6e | 73 20 61 6e 64 20 68 65 |function|s and he|
|000024e0| 6e 63 65 20 69 6e 63 72 | 65 61 73 65 20 74 68 65 |nce incr|ease the|
|000024f0| 20 65 61 73 65 20 6f 66 | 20 6d 61 69 6e 74 65 6e | ease of| mainten|
|00002500| 61 6e 63 65 20 61 6e 64 | 20 70 6f 72 74 61 62 69 |ance and| portabi|
|00002510| 6c 69 74 79 20 28 69 66 | 20 75 73 65 64 20 65 6c |lity (if| used el|
|00002520| 65 67 61 6e 74 6c 79 29 | 2e 20 4f 6e 65 20 71 75 |egantly)|. One qu|
|00002530| 65 73 74 69 6f 6e 20 73 | 74 69 6c 6c 20 72 65 6d |estion s|till rem|
|00002540| 61 69 6e 73 3a 20 57 68 | 79 20 43 2b 2b 3f 20 0d |ains: Wh|y C++? .|
|00002550| 4e 6f 74 61 62 6c 65 73 | 20 73 75 63 68 20 61 73 |Notables| such as|
|00002560| 20 42 6a 61 72 6e 65 20 | 53 74 72 6f 75 73 74 72 | Bjarne |Stroustr|
|00002570| 75 70 20 61 6e 64 20 53 | 74 61 6e 6c 65 79 20 4c |up and S|tanley L|
|00002580| 69 70 70 6d 61 6e 20 68 | 61 76 65 20 70 6f 69 6e |ippman h|ave poin|
|00002590| 74 65 64 20 6f 75 74 20 | 73 6f 6d 65 20 6f 66 20 |ted out |some of |
|000025a0| 74 68 65 20 61 64 76 61 | 6e 74 61 67 65 73 20 43 |the adva|ntages C|
|000025b0| 2b 2b 20 6f 66 66 65 72 | 73 20 6f 76 65 72 20 63 |++ offer|s over c|
|000025c0| 6f 6e 76 65 6e 74 69 6f | 6e 61 6c 20 68 69 67 68 |onventio|nal high|
|000025d0| 2d 6c 65 76 65 6c 20 6c | 61 6e 67 75 61 67 65 73 |-level l|anguages|
|000025e0| 2e 20 43 2b 2b 20 6f 66 | 66 65 72 73 20 67 72 65 |. C++ of|fers gre|
|000025f0| 61 74 20 65 78 74 65 6e | 73 69 6f 6e 73 2c 20 73 |at exten|sions, s|
|00002600| 75 63 68 20 61 73 20 6f | 70 65 72 61 74 6f 72 20 |uch as o|perator |
|00002610| 61 6e 64 20 66 75 6e 63 | 74 69 6f 6e 20 6f 76 65 |and func|tion ove|
|00002620| 72 6c 6f 61 64 69 6e 67 | 2c 20 74 6f 20 73 74 61 |rloading|, to sta|
|00002630| 6e 64 61 72 64 20 43 2e | 20 43 2b 2b 20 69 73 20 |ndard C.| C++ is |
|00002640| 6d 75 63 68 20 6d 6f 72 | 65 20 73 74 72 6f 6e 67 |much mor|e strong|
|00002650| 6c 79 20 74 79 70 65 20 | 63 68 65 63 6b 65 64 20 |ly type |checked |
|00002660| 74 68 61 6e 20 43 2c 20 | 73 6f 20 69 74 20 73 61 |than C, |so it sa|
|00002670| 76 65 73 20 75 73 20 70 | 72 6f 67 72 61 6d 6d 65 |ves us p|rogramme|
|00002680| 72 73 20 66 72 6f 6d 20 | 6f 75 72 73 65 6c 76 65 |rs from |ourselve|
|00002690| 73 2e 20 0d 43 2b 2b 20 | 63 6c 61 73 73 65 73 20 |s. .C++ |classes |
|000026a0| 6f 66 66 65 72 20 61 20 | 77 61 79 20 74 6f 20 65 |offer a |way to e|
|000026b0| 6e 63 61 70 73 75 6c 61 | 74 65 20 64 61 74 61 d1 |ncapsula|te data.|
|000026c0| 61 6e 64 20 66 75 6e 63 | 74 69 6f 6e 73 20 74 68 |and func|tions th|
|000026d0| 61 74 20 6f 70 65 72 61 | 74 65 20 6f 6e 20 74 68 |at opera|te on th|
|000026e0| 65 20 64 61 74 61 d1 77 | 69 74 68 69 6e 20 6f 6e |e data.w|ithin on|
|000026f0| 65 20 75 6e 69 74 2e 20 | 59 6f 75 20 63 61 6e 20 |e unit. |You can |
|00002700| 6d 61 6b 65 20 64 69 66 | 66 65 72 65 6e 74 20 65 |make dif|ferent e|
|00002710| 6c 65 6d 65 6e 74 73 20 | 61 6e 64 20 66 75 6e 63 |lements |and func|
|00002720| 74 69 6f 6e 73 20 d2 70 | 72 69 76 61 74 65 d3 20 |tions .p|rivate. |
|00002730| 74 6f 20 6f 62 6a 65 63 | 74 73 20 6f 66 20 6f 6e |to objec|ts of on|
|00002740| 6c 79 20 6f 6e 65 20 63 | 6c 61 73 73 20 6f 72 20 |ly one c|lass or |
|00002750| d2 70 75 62 6c 69 63 d3 | 20 74 6f 20 6f 62 6a 65 |.public.| to obje|
|00002760| 63 74 73 20 6f 66 20 65 | 76 65 72 79 20 74 79 70 |cts of e|very typ|
|00002770| 65 2e 20 54 68 65 20 70 | 72 69 76 61 74 65 20 61 |e. The p|rivate a|
|00002780| 6e 64 20 70 75 62 6c 69 | 63 20 6e 61 74 75 72 65 |nd publi|c nature|
|00002790| 20 6f 66 20 64 61 74 61 | 20 61 6e 64 20 6d 65 6d | of data| and mem|
|000027a0| 62 65 72 20 66 75 6e 63 | 74 69 6f 6e 73 20 61 6c |ber func|tions al|
|000027b0| 6c 6f 77 73 20 79 6f 75 | 20 74 6f 20 61 63 63 6f |lows you| to acco|
|000027c0| 6d 70 6c 69 73 68 20 72 | 65 61 6c 20 65 6e 63 61 |mplish r|eal enca|
|000027d0| 70 73 75 6c 61 74 69 6f | 6e 2e 0d 43 4f 4d 50 41 |psulatio|n..COMPA|
|000027e0| 52 49 4e 47 20 43 2b 2b | 20 41 4e 44 20 41 53 53 |RING C++| AND ASS|
|000027f0| 45 4d 42 4c 59 20 4c 41 | 4e 47 55 41 47 45 09 0d |EMBLY LA|NGUAGE..|
|00002800| 09 43 2b 2b 09 41 73 73 | 65 6d 62 6c 79 20 4c 61 |.C++.Ass|embly La|
|00002810| 6e 67 75 61 67 65 0d 50 | 72 6f 73 09 50 6f 72 74 |nguage.P|ros.Port|
|00002820| 61 62 6c 65 09 46 61 73 | 74 0d 09 52 65 75 73 61 |able.Fas|t..Reusa|
|00002830| 62 6c 65 09 45 66 66 69 | 63 69 65 6e 74 0d 09 45 |ble.Effi|cient..E|
|00002840| 61 73 79 20 74 6f 20 6d | 61 69 6e 74 61 69 6e 09 |asy to m|aintain.|
|00002850| 43 6f 6d 70 61 63 74 0d | 09 4f 62 6a 65 63 74 2d |Compact.|.Object-|
|00002860| 62 61 73 65 64 20 64 65 | 73 69 67 6e 09 44 69 72 |based de|sign.Dir|
|00002870| 65 63 74 20 61 63 63 65 | 73 73 20 74 6f 20 43 50 |ect acce|ss to CP|
|00002880| 55 0d 09 48 69 67 68 2d | 6c 65 76 65 6c 20 6c 61 |U..High-|level la|
|00002890| 6e 67 75 61 67 65 20 66 | 65 61 74 75 72 65 73 0d |nguage f|eatures.|
|000028a0| 09 44 61 74 61 20 65 6e | 63 61 70 73 75 6c 61 74 |.Data en|capsulat|
|000028b0| 69 6f 6e 0d 43 6f 6e 73 | 09 54 68 72 65 65 20 73 |ion.Cons|.Three s|
|000028c0| 65 70 61 72 61 74 65 20 | 73 6f 75 72 63 65 20 66 |eparate |source f|
|000028d0| 69 6c 65 73 2c 09 4e 6f | 74 20 70 6f 72 74 61 62 |iles,.No|t portab|
|000028e0| 6c 65 0d 09 20 20 20 20 | 6d 75 6c 74 69 70 6c 65 |le.. |multiple|
|000028f0| 20 63 6f 6d 70 69 6c 65 | 73 09 48 61 72 64 20 74 | compile|s.Hard t|
|00002900| 6f 20 6d 61 69 6e 74 61 | 69 6e 0d 09 53 70 65 65 |o mainta|in..Spee|
|00002910| 64 20 69 6e 65 66 66 69 | 63 69 65 6e 74 09 4c 61 |d ineffi|cient.La|
|00002920| 63 6b 69 6e 67 20 68 69 | 67 68 2d 6c 65 76 65 6c |cking hi|gh-level|
|00002930| 20 6c 61 6e 67 75 61 67 | 65 0d 09 50 6f 6c 79 6d | languag|e..Polym|
|00002940| 6f 72 70 68 69 73 6d 20 | 64 69 66 66 69 63 75 6c |orphism |difficul|
|00002950| 74 20 09 20 20 20 20 66 | 65 61 74 75 72 65 73 20 |t . f|eatures |
|00002960| 73 75 63 68 20 61 73 20 | 6c 6f 6f 70 73 0d 09 20 |such as |loops.. |
|00002970| 20 20 20 69 6e 20 73 74 | 61 6e 64 2d 61 6c 6f 6e | in st|and-alon|
|00002980| 65 20 63 6f 64 65 09 20 | 20 20 20 61 6e 64 20 49 |e code. | and I|
|00002990| 46 2d 54 48 45 4e 2d 45 | 4c 53 45 20 0d 09 0d 53 |F-THEN-E|LSE ...S|
|000029a0| 4f 4d 45 20 4c 49 4d 49 | 54 41 54 49 4f 4e 53 0d |OME LIMI|TATIONS.|
|000029b0| 41 73 20 6e 6f 74 65 64 | 2c 20 6f 6e 65 20 76 61 |As noted|, one va|
|000029c0| 6c 75 61 62 6c 65 20 66 | 65 61 74 75 72 65 20 6f |luable f|eature o|
|000029d0| 66 20 43 2b 2b 2c 20 70 | 6f 6c 79 6d 6f 72 70 68 |f C++, p|olymorph|
|000029e0| 69 73 6d 2c 20 69 73 20 | 6e 6f 74 20 72 65 61 64 |ism, is |not read|
|000029f0| 69 6c 79 20 61 76 61 69 | 6c 61 62 6c 65 20 77 68 |ily avai|lable wh|
|00002a00| 65 6e 20 79 6f 75 20 77 | 72 69 74 65 20 61 20 64 |en you w|rite a d|
|00002a10| 65 76 69 63 65 20 64 72 | 69 76 65 72 20 69 6e 20 |evice dr|iver in |
|00002a20| 43 2b 2b 2e 20 4f 74 68 | 65 72 20 6c 69 6d 69 74 |C++. Oth|er limit|
|00002a30| 61 74 69 6f 6e 73 20 69 | 6e 76 6f 6c 76 65 20 77 |ations i|nvolve w|
|00002a40| 6f 72 6b 69 6e 67 20 77 | 69 74 68 20 61 73 73 65 |orking w|ith asse|
|00002a50| 6d 62 6c 79 20 6c 61 6e | 67 75 61 67 65 2c 20 70 |mbly lan|guage, p|
|00002a60| 6f 73 73 69 62 6c 65 20 | 73 70 65 65 64 20 73 61 |ossible |speed sa|
|00002a70| 63 72 69 66 69 63 65 73 | 2c 20 77 6f 72 6b 2d 61 |crifices|, work-a|
|00002a80| 72 6f 75 6e 64 73 20 66 | 6f 72 20 69 6e 74 65 72 |rounds f|or inter|
|00002a90| 73 65 67 6d 65 6e 74 20 | 63 61 6c 6c 73 2c 20 61 |segment |calls, a|
|00002aa0| 6e 64 20 6d 61 6e 67 6c | 65 64 20 70 72 6f 63 65 |nd mangl|ed proce|
|00002ab0| 64 75 72 65 20 6e 61 6d | 65 73 2e 20 0d 50 4f 4c |dure nam|es. .POL|
|00002ac0| 59 4d 4f 52 50 48 49 53 | 4d 0d 42 65 63 61 75 73 |YMORPHIS|M.Becaus|
|00002ad0| 65 20 61 20 64 65 76 69 | 63 65 20 64 72 69 76 65 |e a devi|ce drive|
|00002ae0| 72 20 69 73 20 61 20 73 | 74 61 6e 64 2d 61 6c 6f |r is a s|tand-alo|
|00002af0| 6e 65 20 63 6f 64 65 20 | 72 65 73 6f 75 72 63 65 |ne code |resource|
|00002b00| 2c 20 74 68 65 72 65 20 | 69 73 20 6e 6f 20 d2 67 |, there |is no .g|
|00002b10| 6c 6f 62 61 6c d3 20 73 | 70 61 63 65 20 6f 72 20 |lobal. s|pace or |
|00002b20| 6a 75 6d 70 20 74 61 62 | 6c 65 2e 20 43 2b 2b d5 |jump tab|le. C++.|
|00002b30| 73 20 76 69 72 74 75 61 | 6c 20 66 75 6e 63 74 69 |s virtua|l functi|
|00002b40| 6f 6e 20 74 61 62 6c 65 | 73 20 28 76 54 61 62 6c |on table|s (vTabl|
|00002b50| 65 73 29 2c 20 77 68 69 | 63 68 20 61 72 65 20 74 |es), whi|ch are t|
|00002b60| 68 65 20 6d 65 61 6e 73 | 20 74 6f 20 74 68 65 20 |he means| to the |
|00002b70| 70 6f 6c 79 6d 6f 72 70 | 68 69 73 6d 20 65 6e 64 |polymorp|hism end|
|00002b80| 2c 20 6c 69 76 65 20 69 | 6e 20 61 6e 20 61 70 70 |, live i|n an app|
|00002b90| 6c 69 63 61 74 69 6f 6e | d5 73 20 67 6c 6f 62 61 |lication|.s globa|
|00002ba0| 6c 20 73 70 61 63 65 2e | 20 54 68 65 20 6c 6f 73 |l space.| The los|
|00002bb0| 73 20 6f 66 20 76 69 72 | 74 75 61 6c 20 74 61 62 |s of vir|tual tab|
|00002bc0| 6c 65 73 20 69 73 20 61 | 20 6c 69 6d 69 74 61 74 |les is a| limitat|
|00002bd0| 69 6f 6e 20 6f 66 20 73 | 74 61 6e 64 2d 61 6c 6f |ion of s|tand-alo|
|00002be0| 6e 65 20 63 6f 64 65 2c | 20 6e 6f 74 20 61 20 6c |ne code,| not a l|
|00002bf0| 69 6d 69 74 61 74 69 6f | 6e 20 6f 66 20 43 2b 2b |imitatio|n of C++|
|00002c00| 2e 20 50 61 74 72 69 63 | 6b 20 42 65 61 72 64 d5 |. Patric|k Beard.|
|00002c10| 73 20 61 72 74 69 63 6c | 65 2c 20 d2 50 6f 6c 79 |s articl|e, .Poly|
|00002c20| 6d 6f 72 70 68 69 63 20 | 43 6f 64 65 20 52 65 73 |morphic |Code Res|
|00002c30| 6f 75 72 63 65 73 20 69 | 6e 20 43 2b 2b d3 20 28 |ources i|n C++. (|
|00002c40| 74 68 69 73 20 69 73 73 | 75 65 29 2c 20 73 68 6f |this iss|ue), sho|
|00002c50| 77 73 20 6f 6e 65 20 77 | 61 79 20 74 6f 20 77 6f |ws one w|ay to wo|
|00002c60| 72 6b 20 61 72 6f 75 6e | 64 20 74 68 69 73 20 6c |rk aroun|d this l|
|00002c70| 69 6d 69 74 61 74 69 6f | 6e 2e 20 54 68 65 20 77 |imitatio|n. The w|
|00002c80| 6f 72 6b 2d 61 72 6f 75 | 6e 64 20 74 61 6b 65 73 |ork-arou|nd takes|
|00002c90| 20 73 6f 6d 65 20 65 78 | 74 72 61 20 77 6f 72 6b | some ex|tra work|
|00002ca0| 20 61 6e 64 20 69 73 20 | 64 65 70 65 6e 64 65 6e | and is |dependen|
|00002cb0| 74 20 6f 6e 20 74 68 65 | 20 63 75 72 72 65 6e 74 |t on the| current|
|00002cc0| 20 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 20 | impleme|ntation |
|00002cd0| 6f 66 20 43 46 72 6f 6e | 74 2c 20 77 68 69 63 68 |of CFron|t, which|
|00002ce0| 20 6d 61 79 20 6d 61 6b | 65 20 66 75 74 75 72 65 | may mak|e future|
|00002cf0| 20 63 6f 6d 70 61 74 69 | 62 69 6c 69 74 79 20 61 | compati|bility a|
|00002d00| 20 70 72 6f 62 6c 65 6d | 2e 20 49 6e 20 74 68 65 | problem|. In the|
|00002d10| 20 69 6e 74 65 72 65 73 | 74 73 20 6f 66 20 63 6c | interes|ts of cl|
|00002d20| 61 72 69 74 79 20 61 6e | 64 20 63 6f 6d 70 61 74 |arity an|d compat|
|00002d30| 69 62 69 6c 69 74 79 2c | 20 49 20 68 61 76 65 20 |ibility,| I have |
|00002d40| 63 68 6f 73 65 6e 20 6e | 6f 74 20 74 6f 20 75 73 |chosen n|ot to us|
|00002d50| 65 20 70 6f 6c 79 6d 6f | 72 70 68 69 73 6d 20 66 |e polymo|rphism f|
|00002d60| 6f 72 20 74 68 65 20 65 | 78 61 6d 70 6c 65 20 69 |or the e|xample i|
|00002d70| 6e 20 74 68 69 73 20 61 | 72 74 69 63 6c 65 2e 0d |n this a|rticle..|
|00002d80| 41 53 53 45 4d 42 4c 59 | 2d 4c 41 4e 47 55 41 47 |ASSEMBLY|-LANGUAG|
|00002d90| 45 20 4d 55 43 4b 0d 41 | 6e 6f 74 68 65 72 20 64 |E MUCK.A|nother d|
|00002da0| 69 66 66 69 63 75 6c 74 | 79 20 69 73 20 74 68 61 |ifficult|y is tha|
|00002db0| 74 20 77 65 20 68 61 76 | 65 20 74 6f 20 67 65 74 |t we hav|e to get|
|00002dc0| 20 6f 75 72 20 68 61 6e | 64 73 20 61 73 73 65 6d | our han|ds assem|
|00002dd0| 62 6c 79 2d 6c 61 6e 67 | 75 61 67 65 20 64 69 72 |bly-lang|uage dir|
|00002de0| 74 79 2e 20 54 68 65 20 | 44 65 76 69 63 65 20 4d |ty. The |Device M|
|00002df0| 61 6e 61 67 65 72 20 69 | 73 20 67 6f 69 6e 67 20 |anager i|s going |
|00002e00| 74 6f 20 63 61 6c 6c 20 | 74 68 65 20 64 65 76 69 |to call |the devi|
|00002e10| 63 65 20 64 72 69 76 65 | 72 20 77 69 74 68 20 61 |ce drive|r with a|
|00002e20| 20 66 65 77 20 72 65 67 | 69 73 74 65 72 73 20 70 | few reg|isters p|
|00002e30| 6f 69 6e 74 69 6e 67 20 | 74 6f 20 63 65 72 74 61 |ointing |to certa|
|00002e40| 69 6e 20 73 74 72 75 63 | 74 75 72 65 73 2c 20 61 |in struc|tures, a|
|00002e50| 6e 64 20 77 65 d5 6c 6c | 20 68 61 76 65 20 74 6f |nd we.ll| have to|
|00002e60| 20 70 75 74 20 74 68 6f | 73 65 20 6f 6e 20 74 68 | put tho|se on th|
|00002e70| 65 20 73 74 61 63 6b 20 | 73 6f 20 74 68 65 20 43 |e stack |so the C|
|00002e80| 2b 2b 20 72 6f 75 74 69 | 6e 65 73 20 63 61 6e 20 |++ routi|nes can |
|00002e90| 67 65 74 20 74 6f 20 74 | 68 65 6d 2e 20 53 70 65 |get to t|hem. Spe|
|00002ea0| 63 69 66 69 63 61 6c 6c | 79 2c 20 41 30 20 70 6f |cificall|y, A0 po|
|00002eb0| 69 6e 74 73 20 74 6f 20 | 74 68 65 20 70 61 72 61 |ints to |the para|
|00002ec0| 6d 65 74 65 72 20 62 6c | 6f 63 6b 20 74 68 61 74 |meter bl|ock that|
|00002ed0| 20 69 73 20 62 65 69 6e | 67 20 70 61 73 73 65 64 | is bein|g passed|
|00002ee0| 2c 20 61 6e 64 0d 41 31 | 20 68 61 73 20 61 20 68 |, and.A1| has a h|
|00002ef0| 61 6e 64 6c 65 20 74 6f | 20 74 68 65 20 44 65 76 |andle to| the Dev|
|00002f00| 69 63 65 20 43 6f 6e 74 | 72 6f 6c 20 45 6e 74 72 |ice Cont|rol Entr|
|00002f10| 79 20 66 6f 72 20 74 68 | 65 20 64 72 69 76 65 72 |y for th|e driver|
|00002f20| 2e 20 48 61 76 69 6e 67 | 20 74 6f 20 64 6f 20 73 |. Having| to do s|
|00002f30| 6f 6d 65 20 61 73 73 65 | 6d 62 6c 65 72 20 77 6f |ome asse|mbler wo|
|00002f40| 72 6b 20 69 73 20 61 20 | 6c 69 6d 69 74 61 74 69 |rk is a |limitati|
|00002f50| 6f 6e 20 6f 66 20 74 68 | 65 20 6f 70 65 72 61 74 |on of th|e operat|
|00002f60| 69 6e 67 20 73 79 73 74 | 65 6d 3b 20 74 68 65 20 |ing syst|em; the |
|00002f70| 74 6f 6f 6c 62 6f 78 20 | 64 6f 65 73 6e d5 74 20 |toolbox |doesn.t |
|00002f80| 70 75 73 68 20 74 68 65 | 20 70 61 72 61 6d 65 74 |push the| paramet|
|00002f90| 65 72 73 20 6f 6e 74 6f | 20 74 68 65 20 73 74 61 |ers onto| the sta|
|00002fa0| 63 6b 20 28 6e 6f 77 20 | 69 66 20 74 68 65 72 65 |ck (now |if there|
|00002fb0| 20 77 65 72 65 20 67 6c | 75 65 20 74 6f 20 64 6f | were gl|ue to do|
|00002fc0| 20 74 68 61 74 d1 29 2e | 0d 54 68 65 73 65 20 72 | that.).|.These r|
|00002fd0| 65 67 69 73 74 65 72 73 | 20 6d 75 73 74 20 73 6f |egisters| must so|
|00002fe0| 6d 65 68 6f 77 20 6d 61 | 6b 65 20 74 68 65 69 72 |mehow ma|ke their|
|00002ff0| 20 77 61 79 20 6f 6e 74 | 6f 20 74 68 65 20 73 74 | way ont|o the st|
|00003000| 61 63 6b 20 61 73 20 70 | 61 72 61 6d 65 74 65 72 |ack as p|arameter|
|00003010| 73 20 74 6f 20 6f 75 72 | 20 72 6f 75 74 69 6e 65 |s to our| routine|
|00003020| 73 20 62 65 63 61 75 73 | 65 20 70 72 6f 63 65 64 |s becaus|e proced|
|00003030| 75 72 65 73 20 74 61 6b | 65 20 74 68 65 69 72 20 |ures tak|e their |
|00003040| 70 61 72 61 6d 65 74 65 | 72 73 20 6f 66 66 20 74 |paramete|rs off t|
|00003050| 68 65 20 73 74 61 63 6b | 2e 20 57 68 65 6e 20 77 |he stack|. When w|
|00003060| 65 d5 76 65 20 66 69 6e | 69 73 68 65 64 2c 20 77 |e.ve fin|ished, w|
|00003070| 65 20 61 6c 73 6f 20 68 | 61 76 65 20 74 6f 20 64 |e also h|ave to d|
|00003080| 65 61 6c 20 77 69 74 68 | 20 6a 75 6d 70 69 6e 67 |eal with| jumping|
|00003090| 20 74 6f 20 6a 49 4f 44 | 6f 6e 65 20 6f 72 20 70 | to jIOD|one or p|
|000030a0| 6c 61 69 6e 20 52 54 53 | 69 6e 67 2c 20 64 65 70 |lain RTS|ing, dep|
|000030b0| 65 6e 64 69 6e 67 20 6f | 6e 20 74 68 65 20 63 69 |ending o|n the ci|
|000030c0| 72 63 75 6d 73 74 61 6e | 63 65 73 2e 20 46 6f 72 |rcumstan|ces. For|
|000030d0| 20 74 68 65 20 73 69 6d | 70 6c 65 20 64 72 69 76 | the sim|ple driv|
|000030e0| 65 72 20 73 68 6f 77 6e | 20 69 6e 20 74 68 65 20 |er shown| in the |
|000030f0| 65 78 61 6d 70 6c 65 2c | 20 77 65 20 77 69 6c 6c |example,| we will|
|00003100| 20 69 6e 20 72 65 61 6c | 69 74 79 20 61 6c 6d 6f | in real|ity almo|
|00003110| 73 74 20 61 6c 77 61 79 | 73 20 6a 75 6d 70 20 76 |st alway|s jump v|
|00003120| 69 61 20 6a 49 4f 44 6f | 6e 65 20 77 68 65 6e 20 |ia jIODo|ne when |
|00003130| 66 69 6e 69 73 68 65 64 | 20 77 69 74 68 20 6f 75 |finished| with ou|
|00003140| 72 20 72 6f 75 74 69 6e | 65 73 2e 20 42 75 74 2c |r routin|es. But,|
|00003150| 20 66 6f 72 20 64 72 69 | 76 65 72 73 20 74 68 61 | for dri|vers tha|
|00003160| 74 20 77 69 73 68 20 74 | 6f 20 61 6c 6c 6f 77 20 |t wish t|o allow |
|00003170| 6d 6f 72 65 20 74 68 61 | 6e 20 6f 6e 65 20 6f 70 |more tha|n one op|
|00003180| 65 72 61 74 69 6f 6e 20 | 61 74 20 61 20 74 69 6d |eration |at a tim|
|00003190| 65 2c 20 74 68 65 20 50 | 72 69 6d 65 2c 20 43 6f |e, the P|rime, Co|
|000031a0| 6e 74 72 6f 6c 2c 20 61 | 6e 64 20 53 74 61 74 75 |ntrol, a|nd Statu|
|000031b0| 73 20 63 61 6c 6c 73 20 | 6d 75 73 74 20 72 65 74 |s calls |must ret|
|000031c0| 75 72 6e 20 76 69 61 20 | 61 6e 20 52 54 53 20 74 |urn via |an RTS t|
|000031d0| 6f 20 73 69 67 6e 61 6c | 20 74 68 65 20 44 65 76 |o signal| the Dev|
|000031e0| 69 63 65 20 4d 61 6e 61 | 67 65 72 20 74 68 61 74 |ice Mana|ger that|
|000031f0| 20 74 68 65 20 72 65 71 | 75 65 73 74 20 68 61 73 | the req|uest has|
|00003200| 20 6e 6f 74 20 62 65 65 | 6e 20 63 6f 6d 70 6c 65 | not bee|n comple|
|00003210| 74 65 64 2e 20 54 68 65 | 20 64 72 69 76 65 72 d5 |ted. The| driver.|
|00003220| 73 20 72 6f 75 74 69 6e | 65 73 20 73 68 6f 75 6c |s routin|es shoul|
|00003230| 64 20 6a 75 6d 70 20 74 | 6f 20 6a 49 4f 44 6f 6e |d jump t|o jIODon|
|00003240| 65 20 6f 6e 6c 79 20 77 | 68 65 6e 20 74 68 65 20 |e only w|hen the |
|00003250| 72 65 71 75 65 73 74 20 | 69 73 20 63 6f 6d 70 6c |request |is compl|
|00003260| 65 74 65 2e 20 0d 57 65 | 20 6d 75 73 74 20 61 6c |ete. .We| must al|
|00003270| 73 6f 20 64 65 63 69 64 | 65 20 77 68 65 74 68 65 |so decid|e whethe|
|00003280| 72 20 6f 72 20 6e 6f 74 | 20 74 6f 20 63 61 6c 6c |r or not| to call|
|00003290| 20 61 20 43 2b 2b 20 6d | 65 74 68 6f 64 20 64 69 | a C++ m|ethod di|
|000032a0| 72 65 63 74 6c 79 20 66 | 72 6f 6d 20 74 68 65 20 |rectly f|rom the |
|000032b0| 61 73 73 65 6d 62 6c 79 | 20 6c 61 6e 67 75 61 67 |assembly| languag|
|000032c0| 65 20 d2 67 6c 75 65 2e | d3 20 49 66 20 77 65 20 |e .glue.|. If we |
|000032d0| 63 61 6c 6c 20 74 68 65 | 20 6d 65 74 68 6f 64 20 |call the| method |
|000032e0| 64 69 72 65 63 74 6c 79 | 2c 20 77 65 20 68 61 76 |directly|, we hav|
|000032f0| 65 20 74 6f 20 70 75 74 | 20 74 68 65 20 d2 74 68 |e to put| the .th|
|00003300| 69 73 d3 20 70 6f 69 6e | 74 65 72 20 6f 6e 20 74 |is. poin|ter on t|
|00003310| 68 65 20 73 74 61 63 6b | 20 62 65 63 61 75 73 65 |he stack| because|
|00003320| 20 69 74 d5 73 20 70 61 | 73 73 65 64 20 69 6d 70 | it.s pa|ssed imp|
|00003330| 6c 69 63 69 74 6c 79 20 | 74 6f 20 61 6c 6c 20 6f |licitly |to all o|
|00003340| 62 6a 65 63 74 20 6d 65 | 74 68 6f 64 73 2e 20 57 |bject me|thods. W|
|00003350| 65 20 61 6c 73 6f 20 68 | 61 76 65 20 74 6f 20 75 |e also h|ave to u|
|00003360| 73 65 20 74 68 65 20 d2 | 6d 61 6e 67 6c 65 64 d3 |se the .|mangled.|
|00003370| 20 6e 61 6d 65 20 67 65 | 6e 65 72 61 74 65 64 20 | name ge|nerated |
|00003380| 62 79 20 74 68 65 20 63 | 6f 6d 70 69 6c 65 72 20 |by the c|ompiler |
|00003390| 61 6e 64 20 75 73 65 64 | 20 62 79 20 74 68 65 20 |and used| by the |
|000033a0| 6c 69 6e 6b 65 72 2e 20 | 28 49 66 20 79 6f 75 20 |linker. |(If you |
|000033b0| 68 61 76 65 6e d5 74 20 | 68 61 64 20 74 68 65 20 |haven.t |had the |
|000033c0| 6f 70 70 6f 72 74 75 6e | 69 74 79 20 74 6f 20 73 |opportun|ity to s|
|000033d0| 65 65 20 6d 61 6e 67 6c | 65 64 20 6e 61 6d 65 73 |ee mangl|ed names|
|000033e0| 2c 20 79 6f 75 d5 6c 6c | 20 66 69 6e 64 20 74 68 |, you.ll| find th|
|000033f0| 65 79 d5 72 65 20 61 20 | 6a 6f 79 20 74 6f 20 66 |ey.re a |joy to f|
|00003400| 69 67 75 72 65 20 6f 75 | 74 20 77 69 74 68 6f 75 |igure ou|t withou|
|00003410| 74 20 74 68 65 20 68 65 | 6c 70 20 6f 66 20 6f 75 |t the he|lp of ou|
|00003420| 72 20 66 72 69 65 6e 64 | 20 4d 72 2e 20 55 6e 6d |r friend| Mr. Unm|
|00003430| 61 6e 67 6c 65 2e 29 20 | 53 6f 2c 20 69 66 20 77 |angle.) |So, if w|
|00003440| 65 20 63 68 6f 6f 73 65 | 20 74 6f 20 63 61 6c 6c |e choose| to call|
|00003450| 20 65 78 74 65 72 6e 20 | 43 20 66 75 6e 63 74 69 | extern |C functi|
|00003460| 6f 6e 73 2c 20 61 73 20 | 74 68 65 20 65 78 61 6d |ons, as |the exam|
|00003470| 70 6c 65 20 64 6f 65 73 | 2c 20 77 65 20 72 75 6e |ple does|, we run|
|00003480| 20 69 6e 74 6f 20 79 65 | 74 20 61 6e 6f 74 68 65 | into ye|t anothe|
|00003490| 72 20 6c 65 76 65 6c 20 | 6f 66 20 d2 69 6e 64 69 |r level |of .indi|
|000034a0| 72 65 63 74 69 6f 6e d3 | 20 62 65 66 6f 72 65 20 |rection.| before |
|000034b0| 77 65 20 67 65 74 20 74 | 6f 20 74 68 65 20 72 65 |we get t|o the re|
|000034c0| 61 6c 20 6d 65 61 74 20 | 6f 66 20 74 68 65 20 6d |al meat |of the m|
|000034d0| 61 74 74 65 72 2e 0d 53 | 50 45 45 44 0d 53 6f 6d |atter..S|PEED.Som|
|000034e0| 65 20 6d 69 67 68 74 20 | 73 61 79 20 77 65 20 73 |e might |say we s|
|000034f0| 61 63 72 69 66 69 63 65 | 20 73 70 65 65 64 20 61 |acrifice| speed a|
|00003500| 73 20 77 65 6c 6c 20 61 | 73 20 65 66 66 69 63 69 |s well a|s effici|
|00003510| 65 6e 63 79 d1 61 6e 64 | 20 74 68 65 79 d5 72 65 |ency.and| they.re|
|00003520| 20 63 6f 72 72 65 63 74 | 2e 20 49 6e 20 67 65 6e | correct|. In gen|
|00003530| 65 72 61 6c 2c 20 63 6f | 6d 70 69 6c 65 72 73 20 |eral, co|mpilers |
|00003540| 63 61 6e d5 74 20 67 65 | 6e 65 72 61 74 65 20 6f |can.t ge|nerate o|
|00003550| 70 74 69 6d 61 6c 6c 79 | 20 73 70 65 65 64 2d 65 |ptimally| speed-e|
|00003560| 66 66 69 63 69 65 6e 74 | 20 63 6f 64 65 2e 20 54 |fficient| code. T|
|00003570| 68 65 79 20 63 61 6e 20 | 63 6f 6d 65 20 63 6c 6f |hey can |come clo|
|00003580| 73 65 2c 20 62 75 74 20 | 6e 6f 74 68 69 6e 67 20 |se, but |nothing |
|00003590| 65 76 65 6e 20 61 70 70 | 72 6f 61 63 68 65 73 20 |even app|roaches |
|000035a0| 68 6f 77 20 74 68 65 20 | 68 75 6d 61 6e 20 6d 69 |how the |human mi|
|000035b0| 6e 64 20 74 61 63 6b 6c | 65 73 20 73 6f 6d 65 20 |nd tackl|es some |
|000035c0| 74 72 69 63 6b 79 20 6d | 61 63 68 69 6e 65 2d 6c |tricky m|achine-l|
|000035d0| 65 76 65 6c 20 69 73 73 | 75 65 73 2e 20 54 68 75 |evel iss|ues. Thu|
|000035e0| 73 2c 20 77 65 d5 72 65 | 20 61 74 20 74 68 65 20 |s, we.re| at the |
|000035f0| 6d 65 72 63 79 20 6f 66 | 20 74 68 65 20 63 6f 6d |mercy of| the com|
|00003600| 70 69 6c 65 72 d1 74 68 | 65 20 6c 6f 73 73 20 6f |piler.th|e loss o|
|00003610| 66 20 73 70 65 65 64 20 | 69 73 20 74 68 65 20 72 |f speed |is the r|
|00003620| 65 73 75 6c 74 20 6f 66 | 20 74 68 65 20 63 6f 6d |esult of| the com|
|00003630| 70 69 6c 65 72 d5 73 20 | 69 6e 65 66 66 69 63 69 |piler.s |ineffici|
|00003640| 65 6e 63 79 2e 20 0d 59 | 6f 75 d5 6c 6c 20 70 72 |ency. .Y|ou.ll pr|
|00003650| 6f 62 61 62 6c 79 20 66 | 69 6e 64 20 74 68 65 20 |obably f|ind the |
|00003660| 73 61 6d 70 6c 65 20 64 | 72 69 76 65 72 20 70 72 |sample d|river pr|
|00003670| 65 73 65 6e 74 65 64 20 | 69 6e 20 74 68 69 73 20 |esented |in this |
|00003680| 61 72 74 69 63 6c 65 20 | 70 72 65 74 74 79 20 69 |article |pretty i|
|00003690| 6e 65 66 66 69 63 69 65 | 6e 74 2e 20 42 75 74 20 |nefficie|nt. But |
|000036a0| 74 68 65 20 74 72 61 64 | 65 2d 6f 66 66 20 69 73 |the trad|e-off is|
|000036b0| 20 61 63 63 65 70 74 61 | 62 6c 65 20 62 65 63 61 | accepta|ble beca|
|000036c0| 75 73 65 20 73 70 65 65 | 64 20 69 73 6e d5 74 20 |use spee|d isn.t |
|000036d0| 69 6d 70 6f 72 74 61 6e | 74 20 69 6e 20 74 68 69 |importan|t in thi|
|000036e0| 73 20 63 61 73 65 2c 20 | 61 6e 64 20 79 6f 75 20 |s case, |and you |
|000036f0| 63 61 6e 20 75 73 65 20 | 61 6c 6c 20 74 68 65 20 |can use |all the |
|00003700| 66 65 61 74 75 72 65 73 | 20 6f 66 20 61 6e 20 6f |features| of an o|
|00003710| 62 6a 65 63 74 2d 62 61 | 73 65 64 20 6c 61 6e 67 |bject-ba|sed lang|
|00003720| 75 61 67 65 2e 20 49 6e | 20 66 61 63 74 2c 20 69 |uage. In| fact, i|
|00003730| 6e 20 6d 6f 73 74 20 69 | 6e 73 74 61 6e 63 65 73 |n most i|nstances|
|00003740| 20 79 6f 75 20 63 61 6e | 20 6c 69 6d 69 74 20 61 | you can| limit a|
|00003750| 73 73 65 6d 62 6c 79 20 | 6c 61 6e 67 75 61 67 65 |ssembly |language|
|00003760| 20 74 6f 20 61 20 66 65 | 77 20 72 6f 75 74 69 6e | to a fe|w routin|
|00003770| 65 73 2c 20 77 68 69 63 | 68 20 6d 75 73 74 20 62 |es, whic|h must b|
|00003780| 65 20 74 69 67 68 74 6c | 79 20 63 6f 64 65 64 2c |e tightl|y coded,|
|00003790| 20 61 6e 64 20 75 73 65 | 20 43 2b 2b 20 66 6f 72 | and use| C++ for|
|000037a0| 20 74 68 65 20 72 65 73 | 74 2e 0d 4d 41 4e 47 4c | the res|t..MANGL|
|000037b0| 45 44 20 49 44 45 4e 54 | 49 46 49 45 52 53 0d 49 |ED IDENT|IFIERS.I|
|000037c0| 66 20 79 6f 75 d5 72 65 | 20 66 61 6d 69 6c 69 61 |f you.re| familia|
|000037d0| 72 20 77 69 74 68 20 43 | 2b 2b 2c 20 79 6f 75 d5 |r with C|++, you.|
|000037e0| 76 65 20 75 6e 64 6f 75 | 62 74 65 64 6c 79 20 73 |ve undou|btedly s|
|000037f0| 65 65 6e 20 74 68 65 20 | 76 69 73 69 6f 6e 73 20 |een the |visions |
|00003800| 6f 66 20 75 6e 72 65 61 | 64 61 62 69 6c 69 74 79 |of unrea|dability|
|00003810| 20 63 72 65 61 74 65 64 | 20 62 79 20 43 46 72 6f | created| by CFro|
|00003820| 6e 74 2e 20 42 75 74 2c | 20 69 66 20 79 6f 75 d5 |nt. But,| if you.|
|00003830| 72 65 20 73 74 69 6c 6c | 20 75 6e 66 61 6d 69 6c |re still| unfamil|
|00003840| 69 61 72 20 77 69 74 68 | 20 43 2b 2b 20 69 6e 20 |iar with| C++ in |
|00003850| 70 72 61 63 74 69 63 65 | 2c 20 68 65 72 65 d5 73 |practice|, here.s|
|00003860| 20 61 6e 20 65 78 70 6c | 61 6e 61 74 69 6f 6e 2e | an expl|anation.|
|00003870| 20 43 46 72 6f 6e 74 20 | 69 73 20 73 69 6d 70 6c | CFront |is simpl|
|00003880| 79 20 61 20 70 72 65 70 | 72 6f 63 65 73 73 6f 72 |y a prep|rocessor|
|00003890| 20 74 68 61 74 20 63 72 | 65 61 74 65 73 20 43 20 | that cr|eates C |
|000038a0| 63 6f 64 65 2c 20 77 68 | 69 63 68 20 69 73 20 70 |code, wh|ich is p|
|000038b0| 61 73 73 65 64 20 74 6f | 20 74 68 65 20 43 20 63 |assed to| the C c|
|000038c0| 6f 6d 70 69 6c 65 72 2e | 20 53 6f 20 43 46 72 6f |ompiler.| So CFro|
|000038d0| 6e 74 20 68 61 73 20 74 | 6f 20 73 6f 6d 65 68 6f |nt has t|o someho|
|000038e0| 77 20 74 61 6b 65 20 61 | 20 66 75 6e 63 74 69 6f |w take a| functio|
|000038f0| 6e 20 6f 66 20 74 68 65 | 20 66 6f 72 6d 0d 54 44 |n of the| form.TD|
|00003900| 72 69 76 65 72 3a 3a 69 | 61 63 4f 70 65 6e 28 50 |river::i|acOpen(P|
|00003910| 61 72 6d 42 6c 6b 50 74 | 72 20 61 50 61 72 6d 42 |armBlkPt|r aParmB|
|00003920| 6c 6b 50 74 72 29 20 0d | 61 6e 64 20 63 72 65 61 |lkPtr) .|and crea|
|00003930| 74 65 20 61 20 43 20 66 | 75 6e 63 74 69 6f 6e 20 |te a C f|unction |
|00003940| 6e 61 6d 65 20 74 68 65 | 20 43 20 63 6f 6d 70 69 |name the| C compi|
|00003950| 6c 65 72 20 63 61 6e 20 | 75 6e 64 65 72 73 74 61 |ler can |understa|
|00003960| 6e 64 2e 20 54 68 65 20 | 70 72 6f 62 6c 65 6d 20 |nd. The |problem |
|00003970| 69 73 20 74 68 61 74 20 | 77 68 65 6e 20 74 68 65 |is that |when the|
|00003980| 20 6c 69 6e 6b 65 72 20 | 63 6f 6d 70 6c 61 69 6e | linker |complain|
|00003990| 73 2c 20 69 74 20 77 69 | 6c 6c 20 75 73 65 20 74 |s, it wi|ll use t|
|000039a0| 68 65 20 6d 61 6e 67 6c | 65 64 20 6e 61 6d 65 2c |he mangl|ed name,|
|000039b0| 20 77 68 69 63 68 20 69 | 73 20 68 61 72 64 20 74 | which i|s hard t|
|000039c0| 6f 20 64 65 63 69 70 68 | 65 72 2e 48 65 72 65 d5 |o deciph|er.Here.|
|000039d0| 73 20 68 6f 77 20 69 74 | 20 6c 6f 6f 6b 73 3a 0d |s how it| looks:.|
|000039e0| 66 72 6f 6d 20 4d 50 57 | 20 53 68 65 6c 6c 20 64 |from MPW| Shell d|
|000039f0| 6f 63 75 6d 65 6e 74 0d | 75 6e 6d 61 6e 67 6c 65 |ocument.|unmangle|
|00003a00| 20 69 61 63 4f 70 65 6e | 5f 5f 37 54 44 72 69 76 | iacOpen|__7TDriv|
|00003a10| 65 72 46 50 31 33 50 61 | 72 61 6d 42 6c 6f 63 6b |erFP13Pa|ramBlock|
|00003a20| 52 65 63 0d 55 6e 6d 61 | 6e 67 6c 65 64 20 73 79 |Rec.Unma|ngled sy|
|00003a30| 6d 62 6f 6c 3a 20 54 44 | 72 69 76 65 72 3a 3a 69 |mbol: TD|river::i|
|00003a40| 61 63 4f 70 65 6e 28 50 | 61 72 61 6d 42 6c 6f 63 |acOpen(P|aramBloc|
|00003a50| 6b 52 65 63 2a 29 0d 49 | 74 d5 73 20 63 6c 65 61 |kRec*).I|t.s clea|
|00003a60| 72 20 77 68 79 20 74 68 | 65 73 65 20 6e 61 6d 65 |r why th|ese name|
|00003a70| 73 20 61 72 65 20 72 65 | 66 65 72 72 65 64 20 74 |s are re|ferred t|
|00003a80| 6f 20 61 73 20 6d 61 6e | 67 6c 65 64 20 61 6e 64 |o as man|gled and|
|00003a90| 20 75 6e 6d 61 6e 67 6c | 65 64 2e 20 46 6f 72 74 | unmangl|ed. Fort|
|00003aa0| 75 6e 61 74 65 6c 79 2c | 20 74 68 65 20 75 6e 6d |unately,| the unm|
|00003ab0| 61 6e 67 6c 65 20 74 6f | 6f 6c 20 70 72 6f 76 69 |angle to|ol provi|
|00003ac0| 64 65 64 20 77 69 74 68 | 20 4d 50 57 20 61 6c 6c |ded with| MPW all|
|00003ad0| 6f 77 73 20 79 6f 75 20 | 74 6f 20 64 65 72 69 76 |ows you |to deriv|
|00003ae0| 65 20 74 68 65 20 75 6e | 6d 61 6e 67 6c 65 64 20 |e the un|mangled |
|00003af0| 6e 61 6d 65 20 66 72 6f | 6d 20 74 68 65 20 6d 61 |name fro|m the ma|
|00003b00| 6e 67 6c 65 64 2e 0d 41 | 20 53 41 4d 50 4c 45 20 |ngled..A| SAMPLE |
|00003b10| 43 2b 2b 20 44 52 49 56 | 45 52 0d 54 68 65 20 73 |C++ DRIV|ER.The s|
|00003b20| 61 6d 70 6c 65 20 64 72 | 69 76 65 72 20 74 68 61 |ample dr|iver tha|
|00003b30| 74 20 66 6f 6c 6c 6f 77 | 73 20 69 6c 6c 75 73 74 |t follow|s illust|
|00003b40| 72 61 74 65 73 20 73 6f | 6d 65 20 6f 66 20 74 68 |rates so|me of th|
|00003b50| 65 20 69 73 73 75 65 73 | 20 69 6e 76 6f 6c 76 65 |e issues| involve|
|00003b60| 64 20 69 6e 20 77 72 69 | 74 69 6e 67 20 61 20 64 |d in wri|ting a d|
|00003b70| 65 76 69 63 65 20 64 72 | 69 76 65 72 20 69 6e 20 |evice dr|iver in |
|00003b80| 67 65 6e 65 72 61 6c 2c | 20 61 6e 64 20 73 70 65 |general,| and spe|
|00003b90| 63 69 66 69 63 61 6c 6c | 79 20 69 6e 20 43 2b 2b |cificall|y in C++|
|00003ba0| 2e 20 54 68 65 20 63 6f | 64 65 20 69 73 20 69 6e |. The co|de is in|
|00003bb0| 20 74 68 65 20 66 6f 6c | 64 65 72 20 6c 61 62 65 | the fol|der labe|
|00003bc0| 6c 65 64 20 43 2b 2b 20 | 44 72 69 76 65 72 20 6f |led C++ |Driver o|
|00003bd0| 6e 20 74 68 65 20 44 65 | 76 65 6c 6f 70 65 72 20 |n the De|veloper |
|00003be0| 45 73 73 65 6e 74 69 61 | 6c 73 20 64 69 73 63 2e |Essentia|ls disc.|
|00003bf0| 20 0d 49 4e 54 45 52 41 | 50 50 4c 49 43 41 54 49 | .INTERA|PPLICATI|
|00003c00| 4f 4e 20 43 4f 4d 4d 55 | 4e 49 43 41 54 49 4f 4e |ON COMMU|NICATION|
|00003c10| 0d 54 68 65 20 73 61 6d | 70 6c 65 20 64 72 69 76 |.The sam|ple driv|
|00003c20| 65 72 20 70 65 72 66 6f | 72 6d 73 20 6f 6e 65 20 |er perfo|rms one |
|00003c30| 62 61 73 69 63 20 66 75 | 6e 63 74 69 6f 6e d1 69 |basic fu|nction.i|
|00003c40| 6e 74 65 72 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |nterappl|ication |
|00003c50| 63 6f 6d 6d 75 6e 69 63 | 61 74 69 6f 6e 20 28 49 |communic|ation (I|
|00003c60| 41 43 29 d1 75 6e 64 65 | 72 20 53 79 73 74 65 6d |AC).unde|r System|
|00003c70| 20 36 2e 20 55 6e 64 65 | 72 20 53 79 73 74 65 6d | 6. Unde|r System|
|00003c80| 20 37 20 74 68 65 20 73 | 65 72 76 69 63 65 73 20 | 7 the s|ervices |
|00003c90| 6f 66 20 74 68 69 73 20 | 73 61 6d 70 6c 65 20 64 |of this |sample d|
|00003ca0| 72 69 76 65 72 20 61 72 | 65 6e d5 74 20 6e 65 63 |river ar|en.t nec|
|00003cb0| 65 73 73 61 72 79 20 62 | 65 63 61 75 73 65 20 49 |essary b|ecause I|
|00003cc0| 41 43 20 69 73 20 62 75 | 69 6c 74 20 69 6e 74 6f |AC is bu|ilt into|
|00003cd0| 20 74 68 65 20 73 79 73 | 74 65 6d 2e 20 42 75 74 | the sys|tem. But|
|00003ce0| 20 74 68 65 20 63 6f 6e | 63 65 70 74 73 20 70 72 | the con|cepts pr|
|00003cf0| 65 73 65 6e 74 65 64 20 | 68 65 72 65 20 61 72 65 |esented |here are|
|00003d00| 20 73 74 69 6c 6c 20 73 | 6f 75 6e 64 2c 20 61 6e | still s|ound, an|
|00003d10| 64 20 74 68 65 20 64 72 | 69 76 65 72 20 77 6f 72 |d the dr|iver wor|
|00003d20| 6b 73 20 61 73 20 77 65 | 6c 6c 20 75 6e 64 65 72 |ks as we|ll under|
|00003d30| 20 53 79 73 74 65 6d 20 | 37 20 61 73 20 69 74 20 | System |7 as it |
|00003d40| 64 6f 65 73 20 75 6e 64 | 65 72 20 53 79 73 74 65 |does und|er Syste|
|00003d50| 6d 20 36 2e 20 54 68 65 | 20 64 72 69 76 65 72 20 |m 6. The| driver |
|00003d60| 69 73 20 69 6e 73 74 61 | 6c 6c 65 64 20 61 74 20 |is insta|lled at |
|00003d70| 49 6e 69 74 20 74 69 6d | 65 20 77 69 74 68 20 63 |Init tim|e with c|
|00003d80| 6f 64 65 20 74 68 61 74 | 20 77 61 6c 6b 73 20 74 |ode that| walks t|
|00003d90| 68 72 6f 75 67 68 20 74 | 68 65 20 75 6e 69 74 20 |hrough t|he unit |
|00003da0| 74 61 62 6c 65 20 6c 6f | 6f 6b 69 6e 67 20 66 6f |table lo|oking fo|
|00003db0| 72 20 61 20 73 6c 6f 74 | 2e 20 0d 43 4c 41 53 53 |r a slot|. .CLASS|
|00003dc0| 20 53 54 52 55 43 54 55 | 52 45 0d 54 68 65 20 63 | STRUCTU|RE.The c|
|00003dd0| 6c 61 73 73 65 73 20 61 | 72 65 20 66 61 69 72 6c |lasses a|re fairl|
|00003de0| 79 20 73 74 72 61 69 67 | 68 74 66 6f 72 77 61 72 |y straig|htforwar|
|00003df0| 64 2c 20 73 65 72 76 69 | 6e 67 20 61 73 20 61 6e |d, servi|ng as an|
|00003e00| 20 65 78 61 6d 70 6c 65 | 20 6f 66 20 68 6f 77 20 | example| of how |
|00003e10| 74 6f 20 75 73 65 20 43 | 2b 2b 20 74 6f 20 65 6e |to use C|++ to en|
|00003e20| 63 61 70 73 75 6c 61 74 | 65 20 64 61 74 61 20 77 |capsulat|e data w|
|00003e30| 69 74 68 20 6d 65 74 68 | 6f 64 73 20 77 69 74 68 |ith meth|ods with|
|00003e40| 6f 75 74 20 67 65 74 74 | 69 6e 67 20 69 6e 74 6f |out gett|ing into|
|00003e50| 20 73 6f 6d 65 20 67 6e | 61 72 6c 79 20 63 6c 61 | some gn|arly cla|
|00003e60| 73 73 20 68 69 65 72 61 | 72 63 68 69 65 73 20 74 |ss hiera|rchies t|
|00003e70| 68 61 74 20 77 6f 75 6c | 64 20 6f 6e 6c 79 20 6f |hat woul|d only o|
|00003e80| 62 66 75 73 63 61 74 65 | 20 74 68 65 20 70 6f 69 |bfuscate| the poi|
|00003e90| 6e 74 20 28 61 6e 64 20 | 74 68 61 74 20 61 72 65 |nt (and |that are|
|00003ea0| 6e d5 74 20 79 65 74 20 | 70 6f 73 73 69 62 6c 65 |n.t yet |possible|
|00003eb0| 20 77 69 74 68 20 73 74 | 61 6e 64 2d 61 6c 6f 6e | with st|and-alon|
|00003ec0| 65 20 63 6f 64 65 29 2e | 20 54 77 6f 20 63 6c 61 |e code).| Two cla|
|00003ed0| 73 73 65 73 20 73 75 66 | 66 69 63 65 3a 20 54 44 |sses suf|fice: TD|
|00003ee0| 72 69 76 65 72 20 61 6e | 64 20 54 4d 65 73 73 61 |river an|d TMessa|
|00003ef0| 67 65 2e 20 54 44 72 69 | 76 65 72 20 68 61 6e 64 |ge. TDri|ver hand|
|00003f00| 6c 65 73 20 61 6c 6c 20 | 74 68 65 20 64 72 69 76 |les all |the driv|
|00003f10| 69 6e 67 3b 20 69 74 20 | 72 65 73 70 6f 6e 64 73 |ing; it |responds|
|00003f20| 20 74 6f 20 65 61 63 68 | 20 63 6f 6e 74 72 6f 6c | to each| control|
|00003f30| 20 61 6e 64 20 73 74 61 | 74 75 73 20 63 61 6c 6c | and sta|tus call|
|00003f40| 20 64 65 66 69 6e 65 64 | 20 61 6e 64 20 68 61 6e | defined| and han|
|00003f50| 64 6c 65 73 20 6f 70 65 | 6e 69 6e 67 20 61 6e 64 |dles ope|ning and|
|00003f60| 20 63 6c 6f 73 69 6e 67 | 20 74 68 65 20 64 72 69 | closing| the dri|
|00003f70| 76 65 72 2e 20 49 74 20 | 6b 65 65 70 73 20 74 77 |ver. It |keeps tw|
|00003f80| 6f 20 73 69 6d 70 6c 65 | 20 64 61 74 61 20 73 74 |o simple| data st|
|00003f90| 72 75 63 74 75 72 65 73 | d1 61 6e 20 61 72 72 61 |ructures|.an arra|
|00003fa0| 79 20 6f 66 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |y of app|lication|
|00003fb0| 20 6e 61 6d 65 73 20 74 | 68 61 74 20 68 61 76 65 | names t|hat have|
|00003fc0| 20 72 65 67 69 73 74 65 | 72 65 64 20 61 6e 64 20 | registe|red and |
|00003fd0| 61 6e 20 61 72 72 61 79 | 20 6f 66 20 54 4d 65 73 |an array| of TMes|
|00003fe0| 73 61 67 65 20 70 6f 69 | 6e 74 65 72 73 20 74 68 |sage poi|nters th|
|00003ff0| 61 74 20 6e 65 65 64 20 | 74 6f 20 62 65 20 72 65 |at need |to be re|
|00004000| 63 65 69 76 65 64 2e 20 | 54 4d 65 73 73 61 67 65 |ceived. |TMessage|
|00004010| 20 68 61 6e 64 6c 65 73 | 20 74 68 65 20 6d 65 73 | handles| the mes|
|00004020| 73 61 67 65 73 d1 77 68 | 6f 20 74 68 65 79 d5 72 |sages.wh|o they.r|
|00004030| 65 20 66 72 6f 6d 2c 20 | 77 68 6f 20 74 68 65 79 |e from, |who they|
|00004040| d5 72 65 20 61 64 64 72 | 65 73 73 65 64 20 74 6f |.re addr|essed to|
|00004050| 2c 20 61 6e 64 20 77 68 | 61 74 20 74 68 65 20 6d |, and wh|at the m|
|00004060| 65 73 73 61 67 65 20 69 | 73 2e 20 49 20 74 68 69 |essage i|s. I thi|
|00004070| 6e 6b 20 79 6f 75 d5 6c | 6c 20 66 69 6e 64 20 74 |nk you.l|l find t|
|00004080| 68 65 20 64 65 63 6c 61 | 72 61 74 69 6f 6e 73 20 |he decla|rations |
|00004090| 65 61 73 79 20 72 65 61 | 64 69 6e 67 2e 0d 66 72 |easy rea|ding..fr|
|000040a0| 6f 6d 20 54 44 72 69 76 | 65 72 2e 68 0d 63 6c 61 |om TDriv|er.h.cla|
|000040b0| 73 73 20 54 44 72 69 76 | 65 72 3a 20 70 75 62 6c |ss TDriv|er: publ|
|000040c0| 69 63 20 48 61 6e 64 6c | 65 4f 62 6a 65 63 74 20 |ic Handl|eObject |
|000040d0| 7b 0d 70 75 62 6c 69 63 | 3a 0d 09 09 2f 2f 20 43 |{.public|:...// C|
|000040e0| 6f 6e 73 74 72 75 63 74 | 6f 72 20 61 6e 64 20 64 |onstruct|or and d|
|000040f0| 65 73 74 72 75 63 74 6f | 72 2e 0d 09 09 54 44 72 |estructo|r....TDr|
|00004100| 69 76 65 72 28 29 3b 0d | 09 09 7e 54 44 72 69 76 |iver();.|..~TDriv|
|00004110| 65 72 28 29 3b 0d 09 2f | 2a 20 47 65 6e 65 72 69 |er();../|* Generi|
|00004120| 63 20 64 72 69 76 65 72 | 20 72 6f 75 74 69 6e 65 |c driver| routine|
|00004130| 73 2e 20 54 68 65 73 65 | 20 61 72 65 20 74 68 65 |s. These| are the|
|00004140| 20 6f 6e 6c 79 20 70 75 | 62 6c 69 63 20 69 6e 74 | only pu|blic int|
|00004150| 65 72 66 61 63 65 73 20 | 77 65 20 0d 09 20 2a 20 |erfaces |we .. * |
|00004160| 73 68 6f 77 20 74 6f 20 | 74 68 65 20 77 6f 72 6c |show to |the worl|
|00004170| 64 2e 09 09 09 09 09 09 | 09 09 09 09 09 09 2a 2f |d.......|......*/|
|00004180| 0d 09 4f 53 45 72 72 09 | 69 61 63 4f 70 65 6e 28 |..OSErr.|iacOpen(|
|00004190| 50 61 72 6d 42 6c 6b 50 | 74 72 20 6f 50 61 72 6d |ParmBlkP|tr oParm|
|000041a0| 42 6c 6f 63 6b 29 3b 0d | 09 4f 53 45 72 72 09 69 |Block);.|.OSErr.i|
|000041b0| 61 63 50 72 69 6d 65 28 | 50 61 72 6d 42 6c 6b 50 |acPrime(|ParmBlkP|
|000041c0| 74 72 20 70 50 61 72 6d | 42 6c 6f 63 6b 29 3b 0d |tr pParm|Block);.|
|000041d0| 09 4f 53 45 72 72 09 69 | 61 63 43 6f 6e 74 72 6f |.OSErr.i|acContro|
|000041e0| 6c 28 50 61 72 6d 42 6c | 6b 50 74 72 20 63 6e 74 |l(ParmBl|kPtr cnt|
|000041f0| 6c 50 61 72 6d 42 6c 6f | 63 6b 29 3b 0d 09 4f 53 |lParmBlo|ck);..OS|
|00004200| 45 72 72 09 69 61 63 53 | 74 61 74 75 73 28 50 61 |Err.iacS|tatus(Pa|
|00004210| 72 6d 42 6c 6b 50 74 72 | 20 73 50 61 72 6d 42 6c |rmBlkPtr| sParmBl|
|00004220| 6f 63 6b 29 3b 0d 09 4f | 53 45 72 72 09 69 61 63 |ock);..O|SErr.iac|
|00004230| 43 6c 6f 73 65 28 50 61 | 72 6d 42 6c 6b 50 74 72 |Close(Pa|rmBlkPtr|
|00004240| 20 63 50 61 72 6d 42 6c | 6f 63 6b 29 3b 0d 09 0d | cParmBl|ock);...|
|00004250| 70 72 69 76 61 74 65 3a | 0d 09 2f 2f 20 43 6f 6e |private:|..// Con|
|00004260| 74 72 6f 6c 20 52 6f 75 | 74 69 6e 65 73 2e 0d 09 |trol Rou|tines...|
|00004270| 2f 2a 20 52 65 67 69 73 | 74 65 72 41 70 70 20 74 |/* Regis|terApp t|
|00004280| 61 6b 65 73 20 74 68 65 | 20 73 74 72 69 6e 67 20 |akes the| string |
|00004290| 69 6e 20 69 61 63 52 65 | 63 6f 72 64 2e 61 70 70 |in iacRe|cord.app|
|000042a0| 4e 61 6d 65 20 61 6e 64 | 20 66 69 6e 64 73 20 61 |Name and| finds a|
|000042b0| 20 73 6c 6f 74 0d 09 20 | 2a 20 69 6e 20 74 68 65 | slot.. |* in the|
|000042c0| 20 61 72 72 61 79 20 66 | 6f 72 20 74 68 65 20 6e | array f|or the n|
|000042d0| 61 6d 65 20 28 68 65 6e | 63 65 20 69 74 20 22 72 |ame (hen|ce it "r|
|000042e0| 65 67 69 73 74 65 72 73 | 22 20 74 68 65 20 61 70 |egisters|" the ap|
|000042f0| 70 6c 69 63 61 74 69 6f | 6e 29 2e 0d 09 20 2a 20 |plicatio|n)... * |
|00004300| 53 65 6e 64 4d 65 73 73 | 61 67 65 20 73 65 6e 64 |SendMess|age send|
|00004310| 73 20 61 20 6d 65 73 73 | 61 67 65 20 66 72 6f 6d |s a mess|age from|
|00004320| 20 6f 6e 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | one app|lication|
|00004330| 20 74 6f 20 61 6e 6f 74 | 68 65 72 20 28 61 73 0d | to anot|her (as.|
|00004340| 09 20 2a 20 73 70 65 63 | 69 66 69 65 64 20 62 79 |. * spec|ified by|
|00004350| 20 74 68 65 20 69 61 63 | 52 65 63 6f 72 64 20 66 | the iac|Record f|
|00004360| 69 65 6c 64 73 29 2e 0d | 09 20 2a 20 52 65 63 65 |ields)..|. * Rece|
|00004370| 69 76 65 4d 65 73 73 61 | 67 65 20 70 75 74 73 20 |iveMessa|ge puts |
|00004380| 74 68 65 20 6d 65 73 73 | 61 67 65 20 73 74 72 69 |the mess|age stri|
|00004390| 6e 67 20 69 6e 74 6f 20 | 74 68 65 20 69 61 63 52 |ng into |the iacR|
|000043a0| 65 63 6f 72 64 2e 6d 73 | 67 53 74 72 69 6e 67 20 |ecord.ms|gString |
|000043b0| 0d 09 20 2a 20 66 69 65 | 6c 64 20 69 66 20 74 68 |.. * fie|ld if th|
|000043c0| 65 72 65 27 73 20 61 20 | 6d 65 73 73 61 67 65 20 |ere's a |message |
|000043d0| 66 6f 72 20 74 68 65 20 | 72 65 71 75 65 73 74 69 |for the |requesti|
|000043e0| 6e 67 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 2e 0d |ng appli|cation..|
|000043f0| 09 20 2a 20 55 6e 72 65 | 67 69 73 74 65 72 41 70 |. * Unre|gisterAp|
|00004400| 70 20 72 65 6d 6f 76 65 | 73 20 74 68 65 20 61 70 |p remove|s the ap|
|00004410| 70 6c 69 63 61 74 69 6f | 6e 27 73 20 6e 61 6d 65 |plicatio|n's name|
|00004420| 20 66 72 6f 6d 20 74 68 | 65 20 61 72 72 61 79 20 | from th|e array |
|00004430| 28 68 65 6e 63 65 20 0d | 09 20 2a 20 74 68 65 20 |(hence .|. * the |
|00004440| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 73 20 22 |applicat|ion is "|
|00004450| 75 6e 72 65 67 69 73 74 | 65 72 65 64 22 29 2e 09 |unregist|ered")..|
|00004460| 09 09 09 2a 2f 0d 09 73 | 68 6f 72 74 09 09 52 65 |...*/..s|hort..Re|
|00004470| 67 69 73 74 65 72 41 70 | 70 28 49 41 43 52 65 63 |gisterAp|p(IACRec|
|00004480| 6f 72 64 09 2a 61 6e 49 | 41 43 50 74 72 29 3b 0d |ord.*anI|ACPtr);.|
|00004490| 09 73 68 6f 72 74 09 09 | 53 65 6e 64 4d 65 73 73 |.short..|SendMess|
|000044a0| 61 67 65 28 49 41 43 52 | 65 63 6f 72 64 09 2a 61 |age(IACR|ecord.*a|
|000044b0| 6e 49 41 43 50 74 72 29 | 3b 0d 09 73 68 6f 72 74 |nIACPtr)|;..short|
|000044c0| 09 09 52 65 63 65 69 76 | 65 4d 65 73 73 61 67 65 |..Receiv|eMessage|
|000044d0| 28 49 41 43 52 65 63 6f | 72 64 2a 61 6e 49 41 43 |(IACReco|rd*anIAC|
|000044e0| 50 74 72 29 3b 0d 09 73 | 68 6f 72 74 09 09 55 6e |Ptr);..s|hort..Un|
|000044f0| 72 65 67 69 73 74 65 72 | 41 70 70 28 49 41 43 52 |register|App(IACR|
|00004500| 65 63 6f 72 64 09 2a 61 | 6e 49 41 43 50 74 72 29 |ecord.*a|nIACPtr)|
|00004510| 3b 0d 09 0d 09 2f 2f 20 | 53 74 61 74 75 73 20 52 |;....// |Status R|
|00004520| 6f 75 74 69 6e 65 73 0d | 09 2f 2a 20 57 68 6f 73 |outines.|./* Whos|
|00004530| 54 68 65 72 65 20 72 65 | 74 75 72 6e 73 20 74 68 |There re|turns th|
|00004540| 65 20 73 69 67 6e 61 74 | 75 72 65 20 6f 66 20 6f |e signat|ure of o|
|00004550| 74 68 65 72 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |ther app|lication|
|00004560| 73 20 74 68 61 74 20 0d | 09 20 2a 20 68 61 76 65 |s that .|. * have|
|00004570| 20 72 65 67 69 73 74 65 | 72 65 64 2e 0d 09 20 2a | registe|red... *|
|00004580| 20 41 6e 79 4d 65 73 73 | 61 67 65 73 46 6f 72 4d | AnyMess|agesForM|
|00004590| 65 20 72 65 74 75 72 6e | 73 20 74 68 65 20 6e 75 |e return|s the nu|
|000045a0| 6d 62 65 72 20 6f 66 20 | 6d 65 73 73 61 67 65 73 |mber of |messages|
|000045b0| 20 77 61 69 74 69 6e 67 | 20 66 6f 72 20 74 68 65 | waiting| for the|
|000045c0| 0d 09 20 2a 20 72 65 71 | 75 65 73 74 69 6e 67 20 |.. * req|uesting |
|000045d0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 6e 20 69 |applicat|ion in i|
|000045e0| 61 63 52 65 63 6f 72 64 | 2e 61 63 74 75 61 6c 43 |acRecord|.actualC|
|000045f0| 6f 75 6e 74 2e 09 2a 2f | 0d 09 76 6f 69 64 09 09 |ount..*/|..void..|
|00004600| 57 68 6f 73 54 68 65 72 | 65 28 49 41 43 52 65 63 |WhosTher|e(IACRec|
|00004610| 6f 72 64 09 2a 61 6e 49 | 41 43 50 74 72 29 3b 0d |ord.*anI|ACPtr);.|
|00004620| 09 42 6f 6f 6c 65 61 6e | 09 41 6e 79 4d 65 73 73 |.Boolean|.AnyMess|
|00004630| 61 67 65 73 46 6f 72 4d | 65 28 49 41 43 52 65 63 |agesForM|e(IACRec|
|00004640| 6f 72 64 20 20 20 20 2a | 61 6e 49 41 43 50 74 72 |ord *|anIACPtr|
|00004650| 29 3b 0d 09 0d 09 2f 2f | 20 4d 65 73 73 61 67 65 |);....//| Message|
|00004660| 20 61 72 72 61 79 20 68 | 61 6e 64 6c 69 6e 67 20 | array h|andling |
|00004670| 72 6f 75 74 69 6e 65 73 | 2e 0d 09 2f 2a 20 47 65 |routines|.../* Ge|
|00004680| 74 4d 65 73 73 61 67 65 | 20 67 65 74 73 20 74 68 |tMessage| gets th|
|00004690| 65 20 54 4d 65 73 73 50 | 74 72 20 69 6e 20 66 4d |e TMessP|tr in fM|
|000046a0| 65 73 73 61 67 65 41 72 | 72 61 79 5b 73 69 67 6e |essageAr|ray[sign|
|000046b0| 61 74 75 72 65 5d 2e 0d | 09 20 2a 20 53 65 74 4d |ature]..|. * SetM|
|000046c0| 65 73 73 61 67 65 20 73 | 65 74 73 20 74 68 65 20 |essage s|ets the |
|000046d0| 70 6f 69 6e 74 65 72 20 | 69 6e 20 66 4d 65 73 73 |pointer |in fMess|
|000046e0| 61 67 65 41 72 72 61 79 | 5b 73 69 67 6e 61 74 75 |ageArray|[signatu|
|000046f0| 72 65 5d 20 74 6f 20 0d | 09 20 2a 20 61 4d 73 67 |re] to .|. * aMsg|
|00004700| 50 74 72 2e 20 09 09 09 | 09 09 09 09 09 09 09 09 |Ptr. ...|........|
|00004710| 09 09 09 2a 2f 0d 09 54 | 4d 65 73 73 50 74 72 09 |...*/..T|MessPtr.|
|00004720| 47 65 74 4d 65 73 73 61 | 67 65 28 73 68 6f 72 74 |GetMessa|ge(short|
|00004730| 20 73 69 67 6e 61 74 75 | 72 65 29 3b 0d 09 76 6f | signatu|re);..vo|
|00004740| 69 64 09 09 53 65 74 4d | 65 73 73 61 67 65 28 73 |id..SetM|essage(s|
|00004750| 68 6f 72 74 20 69 6e 64 | 65 78 2c 20 54 4d 65 73 |hort ind|ex, TMes|
|00004760| 73 50 74 72 09 61 4d 73 | 67 50 74 72 29 3b 0d 09 |sPtr.aMs|gPtr);..|
|00004770| 0d 09 2f 2f 20 41 70 70 | 4e 61 6d 65 20 61 72 72 |..// App|Name arr|
|00004780| 61 79 20 68 61 6e 64 6c | 69 6e 67 20 72 6f 75 74 |ay handl|ing rout|
|00004790| 69 6e 65 73 2e 0d 09 2f | 2a 20 47 65 74 41 70 70 |ines.../|* GetApp|
|000047a0| 4e 61 6d 65 20 67 65 74 | 73 20 74 68 65 20 61 70 |Name get|s the ap|
|000047b0| 70 6c 69 63 61 74 69 6f | 6e 20 6e 61 6d 65 20 69 |plicatio|n name i|
|000047c0| 6e 20 66 41 70 70 4e 61 | 6d 65 41 72 72 61 79 5b |n fAppNa|meArray[|
|000047d0| 73 69 67 6e 61 74 75 72 | 65 5d 2e 0d 09 20 2a 20 |signatur|e]... * |
|000047e0| 53 65 74 41 70 70 4e 61 | 6d 65 20 73 65 74 73 20 |SetAppNa|me sets |
|000047f0| 74 68 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |the appl|ication |
|00004800| 69 6e 20 66 41 70 70 4e | 61 6d 65 41 72 72 61 79 |in fAppN|ameArray|
|00004810| 5b 73 69 67 6e 61 74 75 | 72 65 5d 20 0d 09 20 2a |[signatu|re] .. *|
|00004820| 20 74 6f 20 61 6e 41 70 | 70 4e 61 6d 65 2e 09 09 | to anAp|pName...|
|00004830| 09 09 09 09 09 09 09 09 | 09 09 09 2a 2f 0d 09 63 |........|...*/..c|
|00004840| 68 61 72 09 09 2a 47 65 | 74 41 70 70 4e 61 6d 65 |har..*Ge|tAppName|
|00004850| 28 73 68 6f 72 74 20 73 | 69 67 6e 61 74 75 72 65 |(short s|ignature|
|00004860| 29 3b 0d 09 76 6f 69 64 | 09 09 53 65 74 41 70 70 |);..void|..SetApp|
|00004870| 4e 61 6d 65 28 73 68 6f | 72 74 20 73 69 67 6e 61 |Name(sho|rt signa|
|00004880| 74 75 72 65 2c 20 63 68 | 61 72 20 2a 61 6e 41 70 |ture, ch|ar *anAp|
|00004890| 70 4e 61 6d 65 29 3b 0d | 09 2f 2a 20 57 65 20 6b |pName);.|./* We k|
|000048a0| 65 65 70 20 61 6e 20 61 | 72 72 61 79 20 6f 66 20 |eep an a|rray of |
|000048b0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 73 20 74 68 61 |applicat|ions tha|
|000048c0| 74 20 63 61 6e 20 72 65 | 67 69 73 74 65 72 20 77 |t can re|gister w|
|000048d0| 69 74 68 20 74 68 65 20 | 0d 09 20 2a 20 64 72 69 |ith the |.. * dri|
|000048e0| 76 65 72 2e 20 49 27 76 | 65 20 61 72 62 69 74 72 |ver. I'v|e arbitr|
|000048f0| 61 72 69 6c 79 20 73 65 | 74 20 74 68 69 73 20 61 |arily se|t this a|
|00004900| 74 20 31 36 2e 20 57 65 | 20 61 6c 73 6f 20 6b 65 |t 16. We| also ke|
|00004910| 65 70 20 61 6e 20 61 72 | 72 61 79 20 0d 09 20 2a |ep an ar|ray .. *|
|00004920| 20 6f 66 20 54 4d 65 73 | 73 61 67 65 20 70 6f 69 | of TMes|sage poi|
|00004930| 6e 74 65 72 73 20 74 6f | 20 62 65 20 70 61 73 73 |nters to| be pass|
|00004940| 65 64 20 61 72 6f 75 6e | 64 2e 20 54 68 69 73 20 |ed aroun|d. This |
|00004950| 69 73 20 61 6c 73 6f 20 | 61 72 62 69 74 72 61 72 |is also |arbitrar|
|00004960| 69 6c 79 20 0d 09 20 2a | 20 73 65 74 20 61 74 20 |ily .. *| set at |
|00004970| 31 36 2e 20 49 6e 20 74 | 68 65 20 66 75 74 75 72 |16. In t|he futur|
|00004980| 65 2c 20 49 27 64 20 70 | 72 6f 62 61 62 6c 79 20 |e, I'd p|robably |
|00004990| 69 6d 70 6c 65 6d 65 6e | 74 20 74 68 69 73 20 61 |implemen|t this a|
|000049a0| 73 20 61 20 6c 69 73 74 | 20 6f 66 0d 09 20 2a 20 |s a list| of.. * |
|000049b0| 6d 65 73 73 61 67 65 73 | 2e 09 09 09 09 09 09 09 |messages|........|
|000049c0| 09 09 09 09 09 09 09 2a | 2f 0d 09 63 68 61 72 09 |.......*|/..char.|
|000049d0| 09 66 41 70 70 4e 61 6d | 65 41 72 72 61 79 5b 6b |.fAppNam|eArray[k|
|000049e0| 4d 61 78 41 70 70 73 5d | 20 5b 32 35 35 5d 3b 0d |MaxApps]| [255];.|
|000049f0| 09 54 4d 65 73 73 50 74 | 72 09 66 4d 65 73 73 61 |.TMessPt|r.fMessa|
|00004a00| 67 65 41 72 72 61 79 5b | 6b 4d 61 78 4d 65 73 73 |geArray[|kMaxMess|
|00004a10| 61 67 65 73 5d 3b 0d 7d | 3b 0d 66 72 6f 6d 20 54 |ages];.}|;.from T|
|00004a20| 4d 65 73 73 61 67 65 2e | 68 0d 63 6c 61 73 73 20 |Message.|h.class |
|00004a30| 54 4d 65 73 73 61 67 65 | 20 7b 0d 70 75 62 6c 69 |TMessage| {.publi|
|00004a40| 63 3a 0d 09 09 2f 2a 20 | 43 6f 6e 73 74 72 75 63 |c:.../* |Construc|
|00004a50| 74 6f 72 20 61 6e 64 20 | 64 65 73 74 72 75 63 74 |tor and |destruct|
|00004a60| 6f 72 2e 20 43 6f 6e 73 | 74 72 75 63 74 6f 72 20 |or. Cons|tructor |
|00004a70| 77 69 6c 6c 20 62 75 69 | 6c 64 20 74 68 65 20 6d |will bui|ld the m|
|00004a80| 65 73 73 61 67 65 0d 09 | 09 20 2a 20 77 69 74 68 |essage..|. * with|
|00004a90| 20 74 68 65 20 61 70 70 | 72 6f 70 72 69 61 74 65 | the app|ropriate|
|00004aa0| 20 64 61 74 61 20 6d 65 | 6d 62 65 72 73 20 70 61 | data me|mbers pa|
|00004ab0| 73 73 65 64 20 69 6e 2e | 20 09 2a 2f 0d 09 09 54 |ssed in.| .*/...T|
|00004ac0| 4d 65 73 73 61 67 65 28 | 63 68 61 72 20 2a 6d 65 |Message(|char *me|
|00004ad0| 73 73 61 67 65 2c 20 73 | 68 6f 72 74 20 73 65 6e |ssage, s|hort sen|
|00004ae0| 64 65 72 53 69 67 2c 20 | 73 68 6f 72 74 20 72 65 |derSig, |short re|
|00004af0| 63 65 69 76 65 72 53 69 | 67 29 3b 0d 09 09 7e 54 |ceiverSi|g);...~T|
|00004b00| 4d 65 73 73 61 67 65 28 | 29 3b 0d 09 09 09 09 0d |Message(|);......|
|00004b10| 09 09 2f 2a 20 54 77 6f | 20 42 6f 6f 6c 65 61 6e |../* Two| Boolean|
|00004b20| 20 66 75 6e 63 74 69 6f | 6e 73 20 74 68 61 74 20 | functio|ns that |
|00004b30| 73 69 6d 70 6c 79 20 71 | 75 65 72 79 20 74 68 65 |simply q|uery the|
|00004b40| 20 6d 65 73 73 61 67 65 | 20 74 6f 20 73 65 65 20 | message| to see |
|00004b50| 0d 09 09 20 2a 20 69 66 | 20 74 68 65 20 6d 65 73 |... * if| the mes|
|00004b60| 73 61 67 65 20 69 73 20 | 64 65 73 74 69 6e 65 64 |sage is |destined|
|00004b70| 20 66 6f 72 20 74 68 65 | 20 73 69 67 6e 61 74 75 | for the| signatu|
|00004b80| 72 65 20 6f 66 20 74 68 | 65 20 0d 09 09 20 2a 20 |re of th|e ... * |
|00004b90| 52 65 71 75 65 73 74 6f | 72 2e 20 4e 69 63 65 20 |Requesto|r. Nice |
|00004ba0| 65 78 61 6d 70 6c 65 20 | 6f 66 20 66 75 6e 63 74 |example |of funct|
|00004bb0| 69 6f 6e 20 6f 76 65 72 | 6c 6f 61 64 69 6e 67 d1 |ion over|loading.|
|00004bc0| 69 6e 20 74 68 65 20 0d | 09 09 20 2a 20 6f 6e 65 |in the .|.. * one|
|00004bd0| 20 63 61 73 65 20 49 20 | 6a 75 73 74 20 77 61 6e | case I |just wan|
|00004be0| 74 65 64 20 74 6f 20 72 | 65 74 75 72 6e 20 74 72 |ted to r|eturn tr|
|00004bf0| 75 65 20 6f 72 20 66 61 | 6c 73 65 3b 20 69 6e 20 |ue or fa|lse; in |
|00004c00| 74 68 65 20 6f 74 68 65 | 72 0d 09 09 20 2a 20 63 |the othe|r... * c|
|00004c10| 61 73 65 20 49 20 77 61 | 6e 74 65 64 20 74 6f 20 |ase I wa|nted to |
|00004c20| 72 65 74 75 72 6e 20 77 | 68 6f 20 74 68 65 20 6d |return w|ho the m|
|00004c30| 65 73 73 61 67 65 20 77 | 61 73 20 66 72 6f 6d 20 |essage w|as from |
|00004c40| 61 6e 64 20 74 68 65 20 | 61 63 74 75 61 6c 0d 09 |and the |actual..|
|00004c50| 09 20 2a 20 6d 65 73 73 | 61 67 65 20 73 74 72 69 |. * mess|age stri|
|00004c60| 6e 67 2e 20 54 68 69 73 | 20 69 73 20 61 6c 73 6f |ng. This| is also|
|00004c70| 20 6e 69 63 65 20 62 65 | 63 61 75 73 65 20 77 65 | nice be|cause we|
|00004c80| 20 68 61 76 65 20 6f 6e | 6c 79 20 6f 6e 65 20 0d | have on|ly one .|
|00004c90| 09 09 20 2a 20 70 75 62 | 6c 69 63 20 6d 65 6d 62 |.. * pub|lic memb|
|00004ca0| 65 72 20 66 75 6e 63 74 | 69 6f 6e 20 72 65 74 75 |er funct|ion retu|
|00004cb0| 72 6e 69 6e 67 20 61 6e | 79 20 70 72 69 76 61 74 |rning an|y privat|
|00004cc0| 65 20 69 6e 66 6f 72 6d | 61 74 69 6f 6e 2e 20 2a |e inform|ation. *|
|00004cd0| 2f 0d 09 42 6f 6f 6c 65 | 61 6e 09 49 73 4d 65 73 |/..Boole|an.IsMes|
|00004ce0| 73 61 67 65 46 6f 72 4d | 65 28 73 68 6f 72 74 20 |sageForM|e(short |
|00004cf0| 73 69 67 4f 66 52 65 71 | 75 65 73 74 6f 72 29 3b |sigOfReq|uestor);|
|00004d00| 0d 09 42 6f 6f 6c 65 61 | 6e 09 49 73 4d 65 73 73 |..Boolea|n.IsMess|
|00004d10| 61 67 65 46 6f 72 4d 65 | 28 73 68 6f 72 74 20 73 |ageForMe|(short s|
|00004d20| 69 67 4f 66 52 65 71 75 | 65 73 74 6f 72 2c 20 73 |igOfRequ|estor, s|
|00004d30| 68 6f 72 74 20 2a 73 65 | 6e 64 65 72 53 69 67 2c |hort *se|nderSig,|
|00004d40| 20 0d 09 09 09 09 09 09 | 09 09 20 63 68 61 72 20 | .......|.. char |
|00004d50| 2a 6d 65 73 73 61 67 65 | 53 74 72 69 6e 67 29 3b |*message|String);|
|00004d60| 0d 09 0d 70 72 69 76 61 | 74 65 3a 0d 09 2f 2a 20 |...priva|te:../* |
|00004d70| 47 65 74 53 65 6e 64 65 | 72 53 69 67 20 72 65 74 |GetSende|rSig ret|
|00004d80| 75 72 6e 73 20 66 53 65 | 6e 64 65 72 53 69 67 2e |urns fSe|nderSig.|
|00004d90| 0d 09 20 2a 20 53 65 74 | 53 65 6e 64 65 72 53 69 |.. * Set|SenderSi|
|00004da0| 67 20 73 65 74 73 20 66 | 53 65 6e 64 65 72 53 69 |g sets f|SenderSi|
|00004db0| 67 20 74 6f 20 73 69 67 | 6e 61 74 75 72 65 2e 09 |g to sig|nature..|
|00004dc0| 09 09 2a 2f 0d 09 73 68 | 6f 72 74 09 09 47 65 74 |..*/..sh|ort..Get|
|00004dd0| 53 65 6e 64 65 72 53 69 | 67 28 29 3b 0d 09 76 6f |SenderSi|g();..vo|
|00004de0| 69 64 09 09 53 65 74 53 | 65 6e 64 65 72 53 69 67 |id..SetS|enderSig|
|00004df0| 28 73 68 6f 72 74 20 73 | 69 67 6e 61 74 75 72 65 |(short s|ignature|
|00004e00| 29 3b 0d 09 0d 09 2f 2a | 20 47 65 74 52 65 63 65 |);..../*| GetRece|
|00004e10| 69 76 65 72 53 69 67 20 | 72 65 74 75 72 6e 73 20 |iverSig |returns |
|00004e20| 66 52 65 63 65 69 76 65 | 72 53 69 67 2e 0d 09 20 |fReceive|rSig... |
|00004e30| 2a 20 53 65 74 52 65 63 | 65 69 76 65 72 53 69 67 |* SetRec|eiverSig|
|00004e40| 20 73 65 74 73 20 66 52 | 65 63 65 69 76 65 72 53 | sets fR|eceiverS|
|00004e50| 69 67 20 74 6f 20 73 69 | 67 6e 61 74 75 72 65 2e |ig to si|gnature.|
|00004e60| 09 2a 2f 0d 09 73 68 6f | 72 74 09 09 47 65 74 52 |.*/..sho|rt..GetR|
|00004e70| 65 63 65 69 76 65 72 53 | 69 67 28 29 3b 0d 09 76 |eceiverS|ig();..v|
|00004e80| 6f 69 64 09 09 53 65 74 | 52 65 63 65 69 76 65 72 |oid..Set|Receiver|
|00004e90| 53 69 67 28 73 68 6f 72 | 74 20 73 69 67 6e 61 74 |Sig(shor|t signat|
|00004ea0| 75 72 65 29 3b 0d 09 0d | 09 2f 2a 20 47 65 74 4d |ure);...|./* GetM|
|00004eb0| 65 73 73 61 67 65 53 74 | 72 69 6e 67 20 72 65 74 |essageSt|ring ret|
|00004ec0| 75 72 6e 73 20 66 4d 65 | 73 73 61 67 65 53 74 72 |urns fMe|ssageStr|
|00004ed0| 69 6e 67 2e 0d 09 20 2a | 20 53 65 74 4d 65 73 73 |ing... *| SetMess|
|00004ee0| 61 67 65 53 74 72 69 6e | 67 20 73 65 74 73 20 66 |ageStrin|g sets f|
|00004ef0| 4d 65 73 73 61 67 65 53 | 74 72 69 6e 67 20 74 6f |MessageS|tring to|
|00004f00| 20 6d 73 67 53 74 72 69 | 6e 67 2e 09 2a 2f 0d 09 | msgStri|ng..*/..|
|00004f10| 63 68 61 72 09 09 2a 47 | 65 74 4d 65 73 73 61 67 |char..*G|etMessag|
|00004f20| 65 53 74 72 69 6e 67 28 | 29 3b 0d 09 76 6f 69 64 |eString(|);..void|
|00004f30| 09 09 53 65 74 4d 65 73 | 73 61 67 65 53 74 72 69 |..SetMes|sageStri|
|00004f40| 6e 67 28 63 68 61 72 20 | 2a 6d 73 67 53 74 72 69 |ng(char |*msgStri|
|00004f50| 6e 67 29 3b 09 2f 2f 20 | 50 72 69 76 61 74 65 20 |ng);.// |Private |
|00004f60| 64 61 74 61 20 6d 65 6d | 62 65 72 73 2e 20 41 67 |data mem|bers. Ag|
|00004f70| 61 69 6e 2c 20 77 65 20 | 6b 65 65 70 20 73 74 6f |ain, we |keep sto|
|00004f80| 72 61 67 65 20 66 6f 72 | 20 74 68 65 20 73 74 72 |rage for| the str|
|00004f90| 69 6e 67 20 68 65 72 65 | 2e 0d 09 73 68 6f 72 74 |ing here|...short|
|00004fa0| 09 09 66 53 65 6e 64 65 | 72 53 69 67 3b 0d 09 73 |..fSende|rSig;..s|
|00004fb0| 68 6f 72 74 09 09 66 52 | 65 63 65 69 76 65 72 53 |hort..fR|eceiverS|
|00004fc0| 69 67 3b 0d 09 63 68 61 | 72 09 09 66 4d 65 73 73 |ig;..cha|r..fMess|
|00004fd0| 61 67 65 53 74 72 69 6e | 67 5b 32 35 35 5d 3b 0d |ageStrin|g[255];.|
|00004fe0| 7d 3b 0d 54 68 65 20 6f | 6e 6c 79 20 72 65 6d 61 |};.The o|nly rema|
|00004ff0| 69 6e 69 6e 67 20 73 74 | 72 75 63 74 75 72 65 20 |ining st|ructure |
|00005000| 77 6f 72 74 68 79 20 6f | 66 20 6e 6f 74 65 20 69 |worthy o|f note i|
|00005010| 73 20 74 68 65 20 49 41 | 43 52 65 63 6f 72 64 20 |s the IA|CRecord |
|00005020| 73 74 72 75 63 74 75 72 | 65 2e 20 0d 54 68 69 73 |structur|e. .This|
|00005030| 20 73 74 72 75 63 74 75 | 72 65 20 69 73 20 70 61 | structu|re is pa|
|00005040| 73 73 65 64 20 69 6e 20 | 74 68 65 20 63 73 50 61 |ssed in |the csPa|
|00005050| 72 61 6d 20 66 69 65 6c | 64 20 6f 66 20 74 68 65 |ram fiel|d of the|
|00005060| 20 70 61 72 61 6d 65 74 | 65 72 20 62 6c 6f 63 6b | paramet|er block|
|00005070| 20 70 6f 69 6e 74 65 72 | 73 20 70 61 73 73 65 64 | pointer|s passed|
|00005080| 20 74 6f 20 74 68 65 20 | 64 72 69 76 65 72 2e 20 | to the |driver. |
|00005090| 45 73 73 65 6e 74 69 61 | 6c 6c 79 20 74 68 65 20 |Essentia|lly the |
|000050a0| 49 41 43 52 65 63 6f 72 | 64 20 73 74 72 75 63 74 |IACRecor|d struct|
|000050b0| 75 72 65 20 63 6f 6e 74 | 61 69 6e 73 20 61 6c 6c |ure cont|ains all|
|000050c0| 20 74 68 65 20 0d 63 6f | 6e 74 72 6f 6c 20 69 6e | the .co|ntrol in|
|000050d0| 66 6f 72 6d 61 74 69 6f | 6e 2c 20 6f 72 20 72 65 |formatio|n, or re|
|000050e0| 74 75 72 6e 73 20 61 6c | 6c 20 74 68 65 20 73 74 |turns al|l the st|
|000050f0| 61 74 75 73 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |atus inf|ormation|
|00005100| 2c 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |, the ap|plicatio|
|00005110| 6e 20 6e 65 65 64 73 20 | 74 6f 20 63 6f 6d 6d 75 |n needs |to commu|
|00005120| 6e 69 63 61 74 65 d1 74 | 68 65 20 73 69 67 6e 61 |nicate.t|he signa|
|00005130| 74 75 72 65 73 20 6f 66 | 20 74 68 65 20 73 65 6e |tures of| the sen|
|00005140| 64 65 72 20 61 6e 64 20 | 72 65 63 65 69 76 65 72 |der and |receiver|
|00005150| 2c 20 74 68 65 20 6d 65 | 73 73 61 67 65 20 61 6e |, the me|ssage an|
|00005160| 64 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 6e 61 |d applic|ation na|
|00005170| 6d 65 20 73 74 72 69 6e | 67 73 2c 20 61 6e 64 20 |me strin|gs, and |
|00005180| 61 20 63 6f 75 70 6c 65 | 20 6f 66 20 6f 74 68 65 |a couple| of othe|
|00005190| 72 20 63 6f 6e 74 72 6f | 6c 20 66 69 65 6c 64 73 |r contro|l fields|
|000051a0| 2e 0d 66 72 6f 6d 20 49 | 41 43 48 65 61 64 65 72 |..from I|ACHeader|
|000051b0| 73 2e 68 0d 73 74 72 75 | 63 74 20 49 41 43 52 65 |s.h.stru|ct IACRe|
|000051c0| 63 6f 72 64 09 7b 0d 09 | 2f 2f 20 53 69 67 6e 61 |cord.{..|// Signa|
|000051d0| 74 75 72 65 20 6e 75 6d | 62 65 72 20 6f 66 20 61 |ture num|ber of a|
|000051e0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 73 65 6e 64 69 |pplicati|on sendi|
|000051f0| 6e 67 2f 72 65 63 65 69 | 76 69 6e 67 2e 0d 09 73 |ng/recei|ving...s|
|00005200| 68 6f 72 74 09 6d 79 53 | 69 67 6e 61 74 75 72 65 |hort.myS|ignature|
|00005210| 3b 0d 09 2f 2f 20 53 69 | 67 6e 61 74 75 72 65 20 |;..// Si|gnature |
|00005220| 6f 66 20 61 70 70 20 74 | 68 61 74 27 73 20 65 69 |of app t|hat's ei|
|00005230| 74 68 65 72 20 73 65 6e | 74 20 61 20 6d 65 73 73 |ther sen|t a mess|
|00005240| 61 67 65 20 6f 72 20 20 | 09 09 0d 09 2f 2f 20 6f |age or |....// o|
|00005250| 66 20 61 70 70 20 74 6f | 20 77 68 69 63 68 20 74 |f app to| which t|
|00005260| 68 65 20 63 75 72 72 65 | 6e 74 20 61 70 70 20 69 |he curre|nt app i|
|00005270| 73 20 73 65 6e 64 69 6e | 67 2e 0d 09 73 68 6f 72 |s sendin|g...shor|
|00005280| 74 09 70 61 72 74 6e 65 | 72 53 69 67 3b 0d 09 09 |t.partne|rSig;...|
|00005290| 09 09 09 0d 09 2f 2f 20 | 49 6e 64 65 78 20 74 6f |.....// |Index to|
|000052a0| 20 63 79 63 6c 65 20 74 | 68 72 6f 75 67 68 20 74 | cycle t|hrough t|
|000052b0| 68 65 20 61 70 70 73 20 | 74 68 61 74 20 68 61 76 |he apps |that hav|
|000052c0| 65 20 72 65 67 69 73 74 | 65 72 65 64 2e 0d 09 73 |e regist|ered...s|
|000052d0| 68 6f 72 74 09 69 6e 64 | 65 78 46 6f 72 57 68 6f |hort.ind|exForWho|
|000052e0| 73 54 68 65 72 65 3b 0d | 09 2f 2f 20 4e 6f 6e 7a |sThere;.|.// Nonz|
|000052f0| 65 72 6f 20 69 66 20 6d | 65 73 73 61 67 65 73 20 |ero if m|essages |
|00005300| 74 68 65 72 65 20 66 6f | 72 20 72 65 63 69 70 69 |there fo|r recipi|
|00005310| 65 6e 74 2e 0d 09 73 68 | 6f 72 74 09 61 63 74 75 |ent...sh|ort.actu|
|00005320| 61 6c 43 6f 75 6e 74 3b | 0d 09 2f 2f 20 4d 65 73 |alCount;|..// Mes|
|00005330| 73 61 67 65 20 73 74 72 | 69 6e 67 20 62 65 69 6e |sage str|ing bein|
|00005340| 67 20 73 65 6e 74 20 6f | 72 20 72 65 63 65 69 76 |g sent o|r receiv|
|00005350| 65 64 2e 0d 09 63 68 61 | 72 2a 09 6d 65 73 73 61 |ed...cha|r*.messa|
|00005360| 67 65 53 74 72 69 6e 67 | 3b 0d 09 2f 2f 20 53 74 |geString|;..// St|
|00005370| 72 69 6e 67 20 74 6f 20 | 72 65 67 69 73 74 65 72 |ring to |register|
|00005380| 20 61 73 2e 0d 09 63 68 | 61 72 09 2a 61 70 70 4e | as...ch|ar.*appN|
|00005390| 61 6d 65 3b 0d 7d 3b 0d | 52 45 47 49 53 54 45 52 |ame;.};.|REGISTER|
|000053a0| 49 4e 47 20 57 49 54 48 | 20 54 48 45 20 44 52 49 |ING WITH| THE DRI|
|000053b0| 56 45 52 0d 54 6f 20 75 | 73 65 20 74 68 65 20 64 |VER.To u|se the d|
|000053c0| 72 69 76 65 72 2c 20 61 | 6e 20 61 70 70 6c 69 63 |river, a|n applic|
|000053d0| 61 74 69 6f 6e 20 72 65 | 67 69 73 74 65 72 73 20 |ation re|gisters |
|000053e0| 69 74 73 65 6c 66 20 77 | 69 74 68 20 74 68 65 20 |itself w|ith the |
|000053f0| 64 72 69 76 65 72 2c 20 | 74 68 75 73 20 73 69 67 |driver, |thus sig|
|00005400| 6e 69 66 79 69 6e 67 20 | 74 68 61 74 20 74 68 65 |nifying |that the|
|00005410| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 69 73 20 | applica|tion is |
|00005420| 61 62 6c 65 20 74 6f 20 | 72 65 63 65 69 76 65 20 |able to |receive |
|00005430| 61 6e 64 20 73 65 6e 64 | 20 6d 65 73 73 61 67 65 |and send| message|
|00005440| 73 2e 20 54 68 65 20 64 | 72 69 76 65 72 20 72 65 |s. The d|river re|
|00005450| 74 75 72 6e 73 20 61 20 | 75 6e 69 71 75 65 20 73 |turns a |unique s|
|00005460| 69 67 6e 61 74 75 72 65 | 20 66 6f 72 20 74 68 65 |ignature| for the|
|00005470| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 74 6f 20 | applica|tion to |
|00005480| 75 73 65 20 74 68 72 6f | 75 67 68 6f 75 74 20 74 |use thro|ughout t|
|00005490| 68 65 20 63 6f 6d 6d 75 | 6e 69 63 61 74 69 6f 6e |he commu|nication|
|000054a0| 20 73 65 73 73 69 6f 6e | 2e 20 41 20 73 65 63 6f | session|. A seco|
|000054b0| 6e 64 20 28 6f 72 20 74 | 68 69 72 64 2c 20 6f 72 |nd (or t|hird, or|
|000054c0| 20 66 6f 75 72 74 68 29 | 20 61 70 70 6c 69 63 61 | fourth)| applica|
|000054d0| 74 69 6f 6e 20 61 6c 73 | 6f 20 72 65 67 69 73 74 |tion als|o regist|
|000054e0| 65 72 73 20 61 6e 64 20 | 63 6f 6d 6d 75 6e 69 63 |ers and |communic|
|000054f0| 61 74 65 73 20 77 69 74 | 68 20 6f 74 68 65 72 20 |ates wit|h other |
|00005500| 61 70 70 6c 69 63 61 74 | 69 6f 6e 73 20 62 79 20 |applicat|ions by |
|00005510| 73 65 6e 64 69 6e 67 20 | 61 6e 64 20 72 65 63 65 |sending |and rece|
|00005520| 69 76 69 6e 67 20 6d 65 | 73 73 61 67 65 73 20 75 |iving me|ssages u|
|00005530| 73 69 6e 67 20 74 68 65 | 20 63 6f 72 72 65 63 74 |sing the| correct|
|00005540| 20 73 69 67 6e 61 74 75 | 72 65 2e 20 57 68 65 6e | signatu|re. When|
|00005550| 20 61 6e 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 | an appl|ication |
|00005560| 69 73 20 66 69 6e 69 73 | 68 65 64 2c 20 69 74 20 |is finis|hed, it |
|00005570| 73 69 6d 70 6c 79 20 75 | 6e 72 65 67 69 73 74 65 |simply u|nregiste|
|00005580| 72 73 20 69 74 73 65 6c | 66 2e 20 48 65 72 65 20 |rs itsel|f. Here |
|00005590| 61 72 65 20 66 6f 75 72 | 20 6f 66 20 74 68 65 20 |are four| of the |
|000055a0| 6d 65 74 68 6f 64 73 20 | 74 68 61 74 20 64 6f 20 |methods |that do |
|000055b0| 6d 6f 73 74 20 6f 66 20 | 74 68 65 20 77 6f 72 6b |most of |the work|
|000055c0| 3a 66 72 6f 6d 20 54 44 | 72 69 76 65 72 2e 63 70 |:from TD|river.cp|
|000055d0| 0d 2f 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |./******|********|
|000055e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055f0| 2a 2a 2a 43 6f 6d 6d 65 | 6e 74 2a 2a 2a 2a 2a 2a |***Comme|nt******|
|00005600| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005610| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005620| 2a 2a 0d 2a 20 54 44 72 | 69 76 65 72 3a 3a 52 65 |**.* TDr|iver::Re|
|00005630| 67 69 73 74 65 72 41 70 | 70 20 6c 6f 6f 6b 73 20 |gisterAp|p looks |
|00005640| 74 6f 20 73 65 65 20 69 | 66 20 74 68 65 72 65 27 |to see i|f there'|
|00005650| 73 20 61 6e 20 6f 70 65 | 6e 20 22 73 6c 6f 74 22 |s an ope|n "slot"|
|00005660| 2e 20 20 49 66 20 73 6f | 2c 20 69 74 20 73 65 74 |. If so|, it set|
|00005670| 73 20 0d 2a 20 74 68 65 | 20 6e 65 77 20 41 70 70 |s .* the| new App|
|00005680| 4e 61 6d 65 20 66 6f 72 | 20 74 68 61 74 20 22 73 |Name for| that "s|
|00005690| 6c 6f 74 22 20 61 6e 64 | 20 72 65 74 75 72 6e 73 |lot" and| returns|
|000056a0| 20 74 68 65 20 22 73 6c | 6f 74 22 20 61 73 20 74 | the "sl|ot" as t|
|000056b0| 68 65 20 73 69 67 6e 61 | 74 75 72 65 2e 20 20 49 |he signa|ture. I|
|000056c0| 66 20 69 74 20 0d 2a 20 | 63 6f 75 6c 64 6e 27 74 |f it .* |couldn't|
|000056d0| 20 66 69 6e 64 20 61 6e | 79 20 6f 70 65 6e 20 22 | find an|y open "|
|000056e0| 73 6c 6f 74 73 22 20 74 | 68 65 6e 20 69 74 20 72 |slots" t|hen it r|
|000056f0| 65 74 75 72 6e 73 20 74 | 68 65 20 6b 4e 6f 4d 6f |eturns t|he kNoMo|
|00005700| 72 65 20 65 72 72 6f 72 | 2e 0d 20 2a 2a 2a 2a 2a |re error|.. *****|
|00005710| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005720| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 45 6e 64 20 |********|****End |
|00005730| 43 6f 6d 6d 65 6e 74 2a | 2a 2a 2a 2a 2a 2a 2a 2a |Comment*|********|
|00005740| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005750| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2f 0d 73 68 6f 72 |********|**/.shor|
|00005760| 74 0d 54 44 72 69 76 65 | 72 3a 3a 52 65 67 69 73 |t.TDrive|r::Regis|
|00005770| 74 65 72 41 70 70 28 49 | 41 43 52 65 63 6f 72 64 |terApp(I|ACRecord|
|00005780| 20 2a 61 6e 49 41 43 50 | 74 72 29 0d 7b 0d 73 68 | *anIACP|tr).{.sh|
|00005790| 6f 72 74 09 09 09 69 20 | 3d 20 30 3b 0d 73 68 6f |ort...i |= 0;.sho|
|000057a0| 72 74 09 09 09 63 61 6e | 44 6f 20 3d 20 6b 4e 6f |rt...can|Do = kNo|
|000057b0| 4d 6f 72 65 3b 0d 77 68 | 69 6c 65 20 28 28 69 20 |More;.wh|ile ((i |
|000057c0| 3c 20 6b 4d 61 78 41 70 | 70 73 29 20 26 26 20 28 |< kMaxAp|ps) && (|
|000057d0| 63 61 6e 44 6f 20 3d 3d | 20 6b 4e 6f 4d 6f 72 65 |canDo ==| kNoMore|
|000057e0| 29 29 0d 09 7b 0d 09 69 | 66 28 28 74 68 69 73 2d |))..{..i|f((this-|
|000057f0| 3e 47 65 74 41 70 70 4e | 61 6d 65 28 69 29 29 5b |>GetAppN|ame(i))[|
|00005800| 30 5d 20 3d 3d 20 6b 5a | 65 72 6f 43 68 61 72 29 |0] == kZ|eroChar)|
|00005810| 0d 09 09 7b 0d 09 09 63 | 61 6e 44 6f 20 3d 20 6b |...{...c|anDo = k|
|00005820| 4e 6f 45 72 72 3b 0d 09 | 09 61 6e 49 41 43 50 74 |NoErr;..|.anIACPt|
|00005830| 72 2d 3e 6d 79 53 69 67 | 6e 61 74 75 72 65 20 3d |r->mySig|nature =|
|00005840| 20 69 3b 0d 09 09 74 68 | 69 73 2d 3e 53 65 74 41 | i;...th|is->SetA|
|00005850| 70 70 4e 61 6d 65 28 69 | 2c 61 6e 49 41 43 50 74 |ppName(i|,anIACPt|
|00005860| 72 2d 3e 61 70 70 4e 61 | 6d 65 29 3b 0d 09 09 7d |r->appNa|me);...}|
|00005870| 0d 09 69 2b 2b 3b 0d 09 | 7d 0d 72 65 74 75 72 6e |..i++;..|}.return|
|00005880| 20 28 63 61 6e 44 6f 29 | 3b 0d 7d 20 2f 2f 20 20 | (canDo)|;.} // |
|00005890| 54 44 72 69 76 65 72 3a | 3a 52 65 67 69 73 74 65 |TDriver:|:Registe|
|000058a0| 72 41 70 70 0d 2f 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |rApp./**|********|
|000058b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000058c0| 2a 2a 2a 2a 2a 2a 2a 43 | 6f 6d 6d 65 6e 74 2a 2a |*******C|omment**|
|000058d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000058e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000058f0| 2a 2a 2a 2a 2a 2a 0d 2a | 20 54 44 72 69 76 65 72 |******.*| TDriver|
|00005900| 3a 3a 53 65 6e 64 4d 65 | 73 73 61 67 65 20 68 61 |::SendMe|ssage ha|
|00005910| 73 20 74 6f 20 69 6e 73 | 74 61 6e 74 69 61 74 65 |s to ins|tantiate|
|00005920| 20 61 20 6e 65 77 20 6d | 65 73 73 61 67 65 20 6f | a new m|essage o|
|00005930| 62 6a 65 63 74 2e 20 20 | 49 74 20 61 6c 73 6f 20 |bject. |It also |
|00005940| 68 61 73 20 74 6f 0d 2a | 20 72 65 6d 65 6d 62 65 |has to.*| remembe|
|00005950| 72 20 74 68 61 74 20 6d | 65 73 73 61 67 65 20 66 |r that m|essage f|
|00005960| 6f 72 20 6c 61 74 65 72 | 20 77 68 65 6e 20 73 6f |or later| when so|
|00005970| 6d 65 6f 6e 65 20 74 72 | 69 65 73 20 74 6f 20 72 |meone tr|ies to r|
|00005980| 65 63 65 69 76 65 20 69 | 74 2e 20 20 54 6f 20 72 |eceive i|t. To r|
|00005990| 65 6d 65 6d 62 65 72 20 | 0d 2a 20 69 74 2c 20 74 |emember |.* it, t|
|000059a0| 68 65 20 54 44 72 69 76 | 65 72 20 6f 62 6a 65 63 |he TDriv|er objec|
|000059b0| 74 20 70 6c 61 63 65 73 | 20 69 74 20 69 6e 20 74 |t places| it in t|
|000059c0| 68 65 20 6d 65 73 73 61 | 67 65 20 70 6f 69 6e 74 |he messa|ge point|
|000059d0| 65 72 20 61 72 72 61 79 | 2e 20 20 49 66 20 69 74 |er array|. If it|
|000059e0| 20 63 6f 75 6c 64 6e 27 | 74 20 0d 2a 20 66 69 6e | couldn'|t .* fin|
|000059f0| 64 20 61 6e 20 6f 70 65 | 6e 20 22 73 6c 6f 74 22 |d an ope|n "slot"|
|00005a00| 20 69 6e 20 74 68 65 20 | 61 72 72 61 79 2c 20 69 | in the |array, i|
|00005a10| 74 20 72 65 74 75 72 6e | 73 20 74 68 65 20 65 72 |t return|s the er|
|00005a20| 72 6f 72 20 6b 4d 73 67 | 4d 65 6d 45 72 72 2c 20 |ror kMsg|MemErr, |
|00005a30| 6d 65 61 6e 69 6e 67 20 | 69 74 20 0d 2a 20 68 61 |meaning |it .* ha|
|00005a40| 73 20 6e 6f 20 6d 65 6d | 6f 72 79 20 74 6f 20 73 |s no mem|ory to s|
|00005a50| 74 6f 72 65 20 74 68 65 | 20 70 6f 69 6e 74 65 72 |tore the| pointer|
|00005a60| 20 74 6f 20 74 68 65 20 | 6d 65 73 73 61 67 65 20 | to the |message |
|00005a70| 61 6e 64 20 68 65 6e 63 | 65 20 74 68 65 20 6d 65 |and henc|e the me|
|00005a80| 73 73 61 67 65 20 64 69 | 64 6e 27 74 20 0d 2a 20 |ssage di|dn't .* |
|00005a90| 67 65 74 20 73 65 6e 74 | 2e 20 53 69 6e 63 65 20 |get sent|. Since |
|00005aa0| 74 68 65 20 54 44 72 69 | 76 65 72 20 6f 62 6a 65 |the TDri|ver obje|
|00005ab0| 63 74 20 69 73 20 63 72 | 65 61 74 69 6e 67 20 61 |ct is cr|eating a|
|00005ac0| 20 6e 65 77 20 54 4d 65 | 73 73 61 67 65 2c 20 69 | new TMe|ssage, i|
|00005ad0| 74 20 77 69 6c 6c 20 64 | 65 73 74 72 6f 79 20 0d |t will d|estroy .|
|00005ae0| 2a 20 74 68 65 20 54 4d | 65 73 73 61 67 65 20 77 |* the TM|essage w|
|00005af0| 68 65 6e 20 74 68 65 20 | 74 69 6d 65 20 63 6f 6d |hen the |time com|
|00005b00| 65 73 2e 0d 20 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |es.. ***|********|
|00005b10| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005b20| 2a 2a 2a 2a 2a 2a 45 6e | 64 20 43 6f 6d 6d 65 6e |******En|d Commen|
|00005b30| 74 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |t*******|********|
|00005b40| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005b50| 2a 2a 2a 2a 2f 0d 73 68 | 6f 72 74 0d 54 44 72 69 |****/.sh|ort.TDri|
|00005b60| 76 65 72 3a 3a 53 65 6e | 64 4d 65 73 73 61 67 65 |ver::Sen|dMessage|
|00005b70| 28 49 41 43 52 65 63 6f | 72 64 20 2a 61 6e 49 41 |(IACReco|rd *anIA|
|00005b80| 43 50 74 72 29 0d 7b 0d | 54 4d 65 73 73 50 74 72 |CPtr).{.|TMessPtr|
|00005b90| 09 61 4d 73 67 50 74 72 | 3b 0d 73 68 6f 72 74 09 |.aMsgPtr|;.short.|
|00005ba0| 09 63 61 6e 44 6f 20 3d | 20 6b 4e 6f 4d 6f 72 65 |.canDo =| kNoMore|
|00005bb0| 3b 0d 73 68 6f 72 74 09 | 09 69 20 3d 20 30 3b 0d |;.short.|.i = 0;.|
|00005bc0| 61 4d 73 67 50 74 72 20 | 3d 20 6e 65 77 20 54 4d |aMsgPtr |= new TM|
|00005bd0| 65 73 73 61 67 65 28 61 | 6e 49 41 43 50 74 72 2d |essage(a|nIACPtr-|
|00005be0| 3e 6d 65 73 73 61 67 65 | 53 74 72 69 6e 67 2c 20 |>message|String, |
|00005bf0| 61 6e 49 41 43 50 74 72 | 2d 3e 6d 79 53 69 67 6e |anIACPtr|->mySign|
|00005c00| 61 74 75 72 65 2c 0d 09 | 09 09 61 6e 49 41 43 50 |ature,..|..anIACP|
|00005c10| 74 72 2d 3e 70 61 72 74 | 6e 65 72 53 69 67 29 3b |tr->part|nerSig);|
|00005c20| 09 0d 69 66 28 61 4d 73 | 67 50 74 72 29 0d 09 7b |..if(aMs|gPtr)..{|
|00005c30| 0d 09 77 68 69 6c 65 20 | 28 28 69 20 3c 20 6b 4d |..while |((i < kM|
|00005c40| 61 78 4d 65 73 73 61 67 | 65 73 29 20 26 26 20 28 |axMessag|es) && (|
|00005c50| 63 61 6e 44 6f 20 3d 3d | 20 6b 4e 6f 4d 6f 72 65 |canDo ==| kNoMore|
|00005c60| 29 29 0d 09 09 7b 0d 09 | 09 69 66 28 74 68 69 73 |))...{..|.if(this|
|00005c70| 2d 3e 47 65 74 4d 65 73 | 73 61 67 65 28 69 29 20 |->GetMes|sage(i) |
|00005c80| 3d 3d 20 6e 69 6c 29 0d | 09 09 09 7b 0d 09 09 09 |== nil).|...{....|
|00005c90| 74 68 69 73 2d 3e 53 65 | 74 4d 65 73 73 61 67 65 |this->Se|tMessage|
|00005ca0| 28 69 2c 20 61 4d 73 67 | 50 74 72 29 3b 0d 09 09 |(i, aMsg|Ptr);...|
|00005cb0| 09 63 61 6e 44 6f 20 3d | 20 6b 4e 6f 45 72 72 3b |.canDo =| kNoErr;|
|00005cc0| 0d 09 09 09 7d 0d 09 09 | 69 2b 2b 3b 0d 09 09 7d |....}...|i++;...}|
|00005cd0| 0d 09 69 66 20 28 63 61 | 6e 44 6f 20 3d 3d 20 6b |..if (ca|nDo == k|
|00005ce0| 4e 6f 4d 6f 72 65 29 0d | 09 09 64 65 6c 65 74 65 |NoMore).|..delete|
|00005cf0| 20 61 4d 73 67 50 74 72 | 3b 0d 09 7d 20 2f 2f 20 | aMsgPtr|;..} // |
|00005d00| 69 66 20 61 4d 73 67 50 | 74 72 0d 65 6c 73 65 0d |if aMsgP|tr.else.|
|00005d10| 09 63 61 6e 44 6f 20 3d | 20 6b 4d 73 67 4d 65 6d |.canDo =| kMsgMem|
|00005d20| 45 72 72 3b 0d 72 65 74 | 75 72 6e 20 28 63 61 6e |Err;.ret|urn (can|
|00005d30| 44 6f 29 3b 09 09 0d 7d | 20 2f 2f 20 20 54 44 72 |Do);...}| // TDr|
|00005d40| 69 76 65 72 3a 3a 53 65 | 6e 64 4d 65 73 73 61 67 |iver::Se|ndMessag|
|00005d50| 65 0d 2f 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |e./*****|********|
|00005d60| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005d70| 2a 2a 2a 2a 2a 43 6f 6d | 6d 65 6e 74 2a 2a 2a 2a |*****Com|ment****|
|00005d80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005d90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|00005da0| 2a 20 54 44 72 69 76 65 | 72 3a 3a 52 65 63 65 69 |* TDrive|r::Recei|
|00005db0| 76 65 4d 65 73 73 61 67 | 65 20 66 69 6e 64 73 20 |veMessag|e finds |
|00005dc0| 61 6e 79 20 6d 65 73 73 | 61 67 65 73 20 66 6f 72 |any mess|ages for|
|00005dd0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|00005de0| 20 77 68 6f 73 65 20 0d | 2a 20 73 69 67 6e 61 74 | whose .|* signat|
|00005df0| 75 72 65 20 69 73 20 6d | 79 53 69 67 6e 61 74 75 |ure is m|ySignatu|
|00005e00| 72 65 2e 20 49 74 20 66 | 69 72 73 74 20 63 68 65 |re. It f|irst che|
|00005e10| 63 6b 73 20 74 6f 20 73 | 65 65 20 69 66 20 74 68 |cks to s|ee if th|
|00005e20| 65 72 65 20 61 72 65 20 | 61 6e 79 20 0d 2a 20 6d |ere are |any .* m|
|00005e30| 65 73 73 61 67 65 73 2e | 20 49 66 20 73 6f 2c 20 |essages.| If so, |
|00005e40| 69 74 20 67 65 74 73 20 | 74 68 65 20 6d 65 73 73 |it gets |the mess|
|00005e50| 61 67 65 20 61 6e 64 20 | 61 73 6b 73 20 74 68 65 |age and |asks the|
|00005e60| 20 54 4d 65 73 73 61 67 | 65 20 6f 62 6a 65 63 74 | TMessag|e object|
|00005e70| 20 74 6f 20 0d 2a 20 72 | 65 74 75 72 6e 20 74 68 | to .* r|eturn th|
|00005e80| 65 20 6d 65 73 73 61 67 | 65 20 73 74 72 69 6e 67 |e messag|e string|
|00005e90| 2e 20 54 68 65 6e 20 69 | 74 20 63 6f 70 69 65 73 |. Then i|t copies|
|00005ea0| 20 74 68 65 20 6d 65 73 | 73 61 67 65 20 73 74 72 | the mes|sage str|
|00005eb0| 69 6e 67 20 74 6f 20 74 | 68 65 20 0d 2a 20 63 61 |ing to t|he .* ca|
|00005ec0| 6c 6c 69 6e 67 20 61 70 | 70 6c 69 63 61 74 69 6f |lling ap|plicatio|
|00005ed0| 6e 27 73 20 6d 65 73 73 | 61 67 65 20 62 75 66 66 |n's mess|age buff|
|00005ee0| 65 72 2c 20 70 75 74 73 | 20 74 68 65 20 73 65 6e |er, puts| the sen|
|00005ef0| 64 65 72 27 73 20 73 69 | 67 6e 61 74 75 72 65 20 |der's si|gnature |
|00005f00| 69 6e 20 0d 2a 20 22 70 | 61 72 74 6e 65 72 53 69 |in .* "p|artnerSi|
|00005f10| 67 22 2c 20 61 6e 64 20 | 70 75 74 73 20 74 68 65 |g", and |puts the|
|00005f20| 20 73 65 6e 64 65 72 27 | 73 20 61 70 70 6c 69 63 | sender'|s applic|
|00005f30| 61 74 69 6f 6e 20 6e 61 | 6d 65 20 69 6e 20 61 70 |ation na|me in ap|
|00005f40| 70 4e 61 6d 65 2e 0d 2a | 20 49 74 20 74 68 65 6e |pName..*| It then|
|00005f50| 20 73 65 74 73 20 74 68 | 65 20 22 73 6c 6f 74 22 | sets th|e "slot"|
|00005f60| 20 69 6e 20 74 68 65 20 | 6d 65 73 73 61 67 65 20 | in the |message |
|00005f70| 61 72 72 61 79 20 74 6f | 20 6e 69 6c 20 61 6e 64 |array to| nil and|
|00005f80| 20 64 69 73 70 6f 73 65 | 73 20 6f 66 20 74 68 65 | dispose|s of the|
|00005f90| 20 0d 2a 20 54 4d 65 73 | 73 61 67 65 20 6f 62 6a | .* TMes|sage obj|
|00005fa0| 65 63 74 2e 20 49 66 20 | 74 68 65 72 65 20 77 65 |ect. If |there we|
|00005fb0| 72 65 20 6d 65 73 73 61 | 67 65 73 2c 20 69 74 20 |re messa|ges, it |
|00005fc0| 72 65 74 75 72 6e 73 20 | 74 68 65 20 6b 59 65 73 |returns |the kYes|
|00005fd0| 4d 65 73 73 61 67 65 73 | 46 6f 72 4d 65 20 0d 2a |Messages|ForMe .*|
|00005fe0| 20 76 61 6c 75 65 3b 20 | 6f 74 68 65 72 77 69 73 | value; |otherwis|
|00005ff0| 65 20 69 74 20 72 65 74 | 75 72 6e 73 20 6b 4e 6f |e it ret|urns kNo|
|00006000| 4d 6f 72 65 2e 0d 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a |More.. *|********|
|00006010| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00006020| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 45 6e 64 20 43 6f 6d |********|*End Com|
|00006030| 6d 65 6e 74 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |ment****|********|
|00006040| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00006050| 2a 2a 2f 0d 73 68 6f 72 | 74 0d 54 44 72 69 76 65 |**/.shor|t.TDrive|
|00006060| 72 3a 3a 52 65 63 65 69 | 76 65 4d 65 73 73 61 67 |r::Recei|veMessag|
|00006070| 65 28 49 41 43 52 65 63 | 6f 72 64 20 2a 61 6e 49 |e(IACRec|ord *anI|
|00006080| 41 43 50 74 72 29 0d 7b | 0d 54 4d 65 73 73 50 74 |ACPtr).{|.TMessPt|
|00006090| 72 09 09 61 4d 73 67 50 | 74 72 3b 0d 73 68 6f 72 |r..aMsgP|tr;.shor|
|000060a0| 74 09 09 09 73 65 6e 64 | 65 72 3b 0d 63 68 61 72 |t...send|er;.char|
|000060b0| 09 09 09 2a 62 75 66 50 | 20 3d 20 6e 69 6c 3b 0d |...*bufP| = nil;.|
|000060c0| 69 66 28 74 68 69 73 2d | 3e 41 6e 79 4d 65 73 73 |if(this-|>AnyMess|
|000060d0| 61 67 65 73 46 6f 72 4d | 65 28 61 6e 49 41 43 50 |agesForM|e(anIACP|
|000060e0| 74 72 29 29 0d 09 7b 0d | 09 61 4d 73 67 50 74 72 |tr))..{.|.aMsgPtr|
|000060f0| 20 3d 20 74 68 69 73 2d | 3e 47 65 74 4d 65 73 73 | = this-|>GetMess|
|00006100| 61 67 65 28 61 6e 49 41 | 43 50 74 72 2d 3e 61 63 |age(anIA|CPtr->ac|
|00006110| 74 75 61 6c 43 6f 75 6e | 74 29 3b 0d 09 28 76 6f |tualCoun|t);..(vo|
|00006120| 69 64 29 20 61 4d 73 67 | 50 74 72 2d 3e 49 73 4d |id) aMsg|Ptr->IsM|
|00006130| 65 73 73 61 67 65 46 6f | 72 4d 65 28 61 6e 49 41 |essageFo|rMe(anIA|
|00006140| 43 50 74 72 2d 3e 6d 79 | 53 69 67 6e 61 74 75 72 |CPtr->my|Signatur|
|00006150| 65 2c 26 73 65 6e 64 65 | 72 2c 62 75 66 50 29 3b |e,&sende|r,bufP);|
|00006160| 09 0d 09 61 6e 49 41 43 | 50 74 72 2d 3e 70 61 72 |...anIAC|Ptr->par|
|00006170| 74 6e 65 72 53 69 67 20 | 3d 20 73 65 6e 64 65 72 |tnerSig |= sender|
|00006180| 3b 0d 09 74 73 65 53 74 | 72 43 70 79 28 61 6e 49 |;..tseSt|rCpy(anI|
|00006190| 41 43 50 74 72 2d 3e 6d | 65 73 73 61 67 65 53 74 |ACPtr->m|essageSt|
|000061a0| 72 69 6e 67 2c 62 75 66 | 50 29 3b 0d 09 74 73 65 |ring,buf|P);..tse|
|000061b0| 53 74 72 43 70 79 28 61 | 6e 49 41 43 50 74 72 2d |StrCpy(a|nIACPtr-|
|000061c0| 3e 61 70 70 4e 61 6d 65 | 2c 20 74 68 69 73 2d 3e |>appName|, this->|
|000061d0| 47 65 74 41 70 70 4e 61 | 6d 65 28 61 6e 49 41 43 |GetAppNa|me(anIAC|
|000061e0| 50 74 72 2d 3e 70 61 72 | 74 6e 65 72 53 69 67 29 |Ptr->par|tnerSig)|
|000061f0| 29 3b 0d 09 74 68 69 73 | 2d 3e 53 65 74 4d 65 73 |);..this|->SetMes|
|00006200| 73 61 67 65 28 61 6e 49 | 41 43 50 74 72 2d 3e 61 |sage(anI|ACPtr->a|
|00006210| 63 74 75 61 6c 43 6f 75 | 6e 74 2c 6e 69 6c 29 3b |ctualCou|nt,nil);|
|00006220| 0d 0d 09 09 64 65 6c 65 | 74 65 20 61 4d 73 67 50 |....dele|te aMsgP|
|00006230| 74 72 3b 0d 09 09 72 65 | 74 75 72 6e 20 28 6b 59 |tr;...re|turn (kY|
|00006240| 65 73 4d 65 73 73 61 67 | 65 73 46 6f 72 4d 65 29 |esMessag|esForMe)|
|00006250| 3b 0d 09 09 7d 0d 65 6c | 73 65 0d 09 09 72 65 74 |;...}.el|se...ret|
|00006260| 75 72 6e 28 6b 4e 6f 4d | 6f 72 65 29 3b 0d 7d 20 |urn(kNoM|ore);.} |
|00006270| 2f 2f 20 54 44 72 69 76 | 65 72 3a 3a 52 65 63 65 |// TDriv|er::Rece|
|00006280| 69 76 65 4d 65 73 73 61 | 67 65 0d 2f 2a 2a 2a 2a |iveMessa|ge./****|
|00006290| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000062a0| 2a 2a 2a 2a 43 6f 6d 6d | 65 6e 74 2a 2a 2a 2a 2a |****Comm|ent*****|
|000062b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000062c0| 2a 2a 2a 2a 2a 2a 0d 2a | 20 54 44 72 69 76 65 72 |******.*| TDriver|
|000062d0| 3a 3a 55 6e 72 65 67 69 | 73 74 65 72 41 70 70 20 |::Unregi|sterApp |
|000062e0| 72 65 63 65 69 76 65 73 | 20 61 6c 6c 20 74 68 65 |receives| all the|
|000062f0| 20 6d 65 73 73 61 67 65 | 73 20 66 6f 72 20 74 68 | message|s for th|
|00006300| 65 20 0d 2a 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |e .* app|lication|
|00006310| 20 74 68 61 74 20 69 73 | 20 75 6e 72 65 67 69 73 | that is| unregis|
|00006320| 74 65 72 69 6e 67 2e 20 | 54 68 6f 73 65 20 6d 65 |tering. |Those me|
|00006330| 73 73 61 67 65 73 20 77 | 69 6c 6c 20 0d 2a 20 6a |ssages w|ill .* j|
|00006340| 75 73 74 20 67 65 74 20 | 74 68 72 6f 77 6e 20 61 |ust get |thrown a|
|00006350| 77 61 79 2e 20 53 6f 2c | 20 61 6c 6c 20 74 68 65 |way. So,| all the|
|00006360| 20 6d 65 73 73 61 67 65 | 73 20 64 65 73 74 69 6e | message|s destin|
|00006370| 65 64 20 66 6f 72 20 0d | 2a 20 69 74 20 61 72 65 |ed for .|* it are|
|00006380| 20 64 69 73 70 6f 73 65 | 64 20 6f 66 2c 20 61 6e | dispose|d of, an|
|00006390| 64 20 74 68 65 6e 20 69 | 74 20 73 65 74 73 20 74 |d then i|t sets t|
|000063a0| 68 65 20 6e 61 6d 65 20 | 74 6f 20 27 5c 30 27 20 |he name |to '\0' |
|000063b0| 73 6f 0d 2a 20 6f 74 68 | 65 72 73 20 63 61 6e 20 |so.* oth|ers can |
|000063c0| 70 6c 61 79 2e 0d 20 2a | 2a 2a 2a 2a 2a 2a 2a 2a |play.. *|********|
|000063d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 45 6e |********|******En|
|000063e0| 64 20 43 6f 6d 6d 65 6e | 74 2a 2a 2a 2a 2a 2a 2a |d Commen|t*******|
|000063f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.